OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 SharedFunctionInfo* function_share = SharedFunctionInfo::cast( | 187 SharedFunctionInfo* function_share = SharedFunctionInfo::cast( |
188 HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); | 188 HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); |
189 JSFunction* function = JSFunction::cast( | 189 JSFunction* function = JSFunction::cast( |
190 HEAP->AllocateFunction(*Isolate::Current()->function_map(), | 190 HEAP->AllocateFunction(*Isolate::Current()->function_map(), |
191 function_share, | 191 function_share, |
192 HEAP->undefined_value())->ToObjectChecked()); | 192 HEAP->undefined_value())->ToObjectChecked()); |
193 Map* initial_map = | 193 Map* initial_map = |
194 Map::cast(HEAP->AllocateMap(JS_OBJECT_TYPE, | 194 Map::cast(HEAP->AllocateMap(JS_OBJECT_TYPE, |
195 JSObject::kHeaderSize)->ToObjectChecked()); | 195 JSObject::kHeaderSize)->ToObjectChecked()); |
196 function->set_initial_map(initial_map); | 196 function->set_initial_map(initial_map); |
197 Isolate::Current()->context()->global_object()->SetProperty( | 197 Isolate::Current()->context()->global()->SetProperty( |
198 func_name, function, NONE, kNonStrictMode)->ToObjectChecked(); | 198 func_name, function, NONE, kNonStrictMode)->ToObjectChecked(); |
199 | 199 |
200 JSObject* obj = JSObject::cast( | 200 JSObject* obj = JSObject::cast( |
201 HEAP->AllocateJSObject(function)->ToObjectChecked()); | 201 HEAP->AllocateJSObject(function)->ToObjectChecked()); |
202 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 202 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
203 | 203 |
204 func_name = | 204 func_name = |
205 String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked()); | 205 String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked()); |
206 CHECK(Isolate::Current()->context()->global_object()-> | 206 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(func_name)); |
207 HasLocalProperty(func_name)); | 207 Object* func_value = Isolate::Current()->context()->global()-> |
208 Object* func_value = Isolate::Current()->context()->global_object()-> | |
209 GetProperty(func_name)->ToObjectChecked(); | 208 GetProperty(func_name)->ToObjectChecked(); |
210 CHECK(func_value->IsJSFunction()); | 209 CHECK(func_value->IsJSFunction()); |
211 function = JSFunction::cast(func_value); | 210 function = JSFunction::cast(func_value); |
212 | 211 |
213 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); | 212 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); |
214 String* obj_name = | 213 String* obj_name = |
215 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 214 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); |
216 Isolate::Current()->context()->global_object()->SetProperty( | 215 Isolate::Current()->context()->global()->SetProperty( |
217 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); | 216 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); |
218 String* prop_name = | 217 String* prop_name = |
219 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); | 218 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); |
220 obj->SetProperty(prop_name, | 219 obj->SetProperty(prop_name, |
221 Smi::FromInt(23), | 220 Smi::FromInt(23), |
222 NONE, | 221 NONE, |
223 kNonStrictMode)->ToObjectChecked(); | 222 kNonStrictMode)->ToObjectChecked(); |
224 | 223 |
225 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 224 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
226 | 225 |
227 obj_name = | 226 obj_name = |
228 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 227 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); |
229 CHECK(Isolate::Current()->context()->global_object()-> | 228 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(obj_name)); |
230 HasLocalProperty(obj_name)); | 229 CHECK(Isolate::Current()->context()->global()-> |
231 CHECK(Isolate::Current()->context()->global_object()-> | |
232 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); | 230 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); |
233 obj = JSObject::cast(Isolate::Current()->context()->global_object()-> | 231 obj = JSObject::cast(Isolate::Current()->context()->global()-> |
234 GetProperty(obj_name)->ToObjectChecked()); | 232 GetProperty(obj_name)->ToObjectChecked()); |
235 prop_name = | 233 prop_name = |
236 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); | 234 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); |
237 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); | 235 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); |
238 } | 236 } |
239 | 237 |
240 | 238 |
241 // TODO(1600): compaction of map space is temporary removed from GC. | 239 // TODO(1600): compaction of map space is temporary removed from GC. |
242 #if 0 | 240 #if 0 |
243 static Handle<Map> CreateMap() { | 241 static Handle<Map> CreateMap() { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 if (v8::internal::Snapshot::IsEnabled()) { | 545 if (v8::internal::Snapshot::IsEnabled()) { |
548 CHECK_LE(delta, 2600 * 1024); // 2484. | 546 CHECK_LE(delta, 2600 * 1024); // 2484. |
549 } else { | 547 } else { |
550 CHECK_LE(delta, 2950 * 1024); // 2844 | 548 CHECK_LE(delta, 2950 * 1024); // 2844 |
551 } | 549 } |
552 } | 550 } |
553 } | 551 } |
554 } | 552 } |
555 | 553 |
556 #endif // __linux__ and !USE_SIMULATOR | 554 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |