| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 SharedFunctionInfo* function_share = SharedFunctionInfo::cast( | 179 SharedFunctionInfo* function_share = SharedFunctionInfo::cast( |
| 180 HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); | 180 HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); |
| 181 JSFunction* function = JSFunction::cast( | 181 JSFunction* function = JSFunction::cast( |
| 182 HEAP->AllocateFunction(*Isolate::Current()->function_map(), | 182 HEAP->AllocateFunction(*Isolate::Current()->function_map(), |
| 183 function_share, | 183 function_share, |
| 184 HEAP->undefined_value())->ToObjectChecked()); | 184 HEAP->undefined_value())->ToObjectChecked()); |
| 185 Map* initial_map = | 185 Map* initial_map = |
| 186 Map::cast(HEAP->AllocateMap(JS_OBJECT_TYPE, | 186 Map::cast(HEAP->AllocateMap(JS_OBJECT_TYPE, |
| 187 JSObject::kHeaderSize)->ToObjectChecked()); | 187 JSObject::kHeaderSize)->ToObjectChecked()); |
| 188 function->set_initial_map(initial_map); | 188 function->set_initial_map(initial_map); |
| 189 Isolate::Current()->context()->global()->SetProperty(func_name, | 189 Isolate::Current()->context()->global()->SetProperty( |
| 190 function, | 190 func_name, function, NONE, kNonStrictMode)->ToObjectChecked(); |
| 191 NONE)->ToObjectChecked(); | |
| 192 | 191 |
| 193 JSObject* obj = JSObject::cast( | 192 JSObject* obj = JSObject::cast( |
| 194 HEAP->AllocateJSObject(function)->ToObjectChecked()); | 193 HEAP->AllocateJSObject(function)->ToObjectChecked()); |
| 195 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 194 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
| 196 | 195 |
| 197 func_name = | 196 func_name = |
| 198 String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked()); | 197 String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked()); |
| 199 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(func_name)); | 198 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(func_name)); |
| 200 Object* func_value = Isolate::Current()->context()->global()-> | 199 Object* func_value = Isolate::Current()->context()->global()-> |
| 201 GetProperty(func_name)->ToObjectChecked(); | 200 GetProperty(func_name)->ToObjectChecked(); |
| 202 CHECK(func_value->IsJSFunction()); | 201 CHECK(func_value->IsJSFunction()); |
| 203 function = JSFunction::cast(func_value); | 202 function = JSFunction::cast(func_value); |
| 204 | 203 |
| 205 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); | 204 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); |
| 206 String* obj_name = | 205 String* obj_name = |
| 207 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 206 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); |
| 208 Isolate::Current()->context()->global()->SetProperty( | 207 Isolate::Current()->context()->global()->SetProperty( |
| 209 obj_name, obj, NONE)->ToObjectChecked(); | 208 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); |
| 210 String* prop_name = | 209 String* prop_name = |
| 211 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); | 210 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); |
| 212 obj->SetProperty(prop_name, Smi::FromInt(23), NONE)->ToObjectChecked(); | 211 obj->SetProperty(prop_name, |
| 212 Smi::FromInt(23), |
| 213 NONE, |
| 214 kNonStrictMode)->ToObjectChecked(); |
| 213 | 215 |
| 214 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 216 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
| 215 | 217 |
| 216 obj_name = | 218 obj_name = |
| 217 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 219 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); |
| 218 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(obj_name)); | 220 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(obj_name)); |
| 219 CHECK(Isolate::Current()->context()->global()-> | 221 CHECK(Isolate::Current()->context()->global()-> |
| 220 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); | 222 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); |
| 221 obj = JSObject::cast(Isolate::Current()->context()->global()-> | 223 obj = JSObject::cast(Isolate::Current()->context()->global()-> |
| 222 GetProperty(obj_name)->ToObjectChecked()); | 224 GetProperty(obj_name)->ToObjectChecked()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; | 355 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; |
| 354 global_handles->AddGroup(g1_objects, 2); | 356 global_handles->AddGroup(g1_objects, 2); |
| 355 global_handles->AddGroup(g2_objects, 2); | 357 global_handles->AddGroup(g2_objects, 2); |
| 356 } | 358 } |
| 357 | 359 |
| 358 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 360 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
| 359 | 361 |
| 360 // All objects should be gone. 5 global handles in total. | 362 // All objects should be gone. 5 global handles in total. |
| 361 CHECK_EQ(5, NumberOfWeakCalls); | 363 CHECK_EQ(5, NumberOfWeakCalls); |
| 362 } | 364 } |
| OLD | NEW |