Changeset 12728 in webkit for trunk/JavaScriptCore/kjs/value.cpp
- Timestamp:
- Feb 9, 2006, 10:42:01 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/value.cpp
r12317 r12728 40 40 41 41 namespace KJS { 42 43 JSCell *ConstantValues::undefined = NULL;44 JSCell *ConstantValues::null = NULL;45 JSCell *ConstantValues::jsTrue = NULL;46 JSCell *ConstantValues::jsFalse = NULL;47 42 48 43 static const double D16 = 65536.0; … … 123 118 JSObject *JSValue::toObject(ExecState *exec) const 124 119 { 125 if (SimpleNumber::is(this)) 126 return static_cast<const NumberImp *>(this)->NumberImp::toObject(exec); 127 return downcast()->toObject(exec); 128 } 129 130 bool JSCell::getBoolean(bool &booleanValue) const 131 { 132 if (!isBoolean()) 133 return false; 134 booleanValue = static_cast<const BooleanImp *>(this)->value(); 135 return true; 120 return JSImmediate::isImmediate(this) ? JSImmediate::toObject(this, exec) : downcast()->toObject(exec); 136 121 } 137 122 … … 182 167 } 183 168 184 JSValue *jsNumber(double d) 169 // This method includes a PIC branch to set up the NumberImp's vtable, so we quarantine 170 // it in a separate function to keep the normal case speedy. 171 JSValue *jsNumberCell(double d) 185 172 { 186 JSValue *v = SimpleNumber::make(d); 187 return v ? v : new NumberImp(d); 173 return new NumberImp(d); 188 174 } 189 175 190 void ConstantValues::initIfNeeded() 191 { 192 if (undefined) 193 return; 194 195 undefined = new UndefinedImp(); 196 null = new NullImp(); 197 jsTrue = new BooleanImp(true); 198 jsFalse = new BooleanImp(false); 199 } 200 201 void ConstantValues::mark() 202 { 203 if (JSCell *v = undefined) 204 if (!v->marked()) 205 v->mark(); 206 if (JSCell *v = null) 207 if (!v->marked()) 208 v->mark(); 209 if (JSCell *v = jsTrue) 210 if (!v->marked()) 211 v->mark(); 212 if (JSCell *v = jsFalse) 213 if (!v->marked()) 214 v->mark(); 215 } 216 217 } 176 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.