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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 MaybeObject* maybe_mapp; | 176 MaybeObject* maybe_mapp; |
177 do { | 177 do { |
178 maybe_mapp = HEAP->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 178 maybe_mapp = HEAP->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
179 } while (maybe_mapp->ToObject(&mapp)); | 179 } while (maybe_mapp->ToObject(&mapp)); |
180 HEAP->CollectGarbage(MAP_SPACE); | 180 HEAP->CollectGarbage(MAP_SPACE); |
181 mapp = HEAP->AllocateMap(JS_OBJECT_TYPE, | 181 mapp = HEAP->AllocateMap(JS_OBJECT_TYPE, |
182 JSObject::kHeaderSize)->ToObjectChecked(); | 182 JSObject::kHeaderSize)->ToObjectChecked(); |
183 | 183 |
184 // allocate a garbage | 184 // allocate a garbage |
185 String* func_name = | 185 String* func_name = |
186 String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked()); | 186 String::cast(HEAP->LookupUtf8Symbol("theFunction")->ToObjectChecked()); |
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_object()->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->LookupUtf8Symbol("theFunction")->ToObjectChecked()); |
206 CHECK(Isolate::Current()->context()->global_object()-> | 206 CHECK(Isolate::Current()->context()->global_object()-> |
207 HasLocalProperty(func_name)); | 207 HasLocalProperty(func_name)); |
208 Object* func_value = Isolate::Current()->context()->global_object()-> | 208 Object* func_value = Isolate::Current()->context()->global_object()-> |
209 GetProperty(func_name)->ToObjectChecked(); | 209 GetProperty(func_name)->ToObjectChecked(); |
210 CHECK(func_value->IsJSFunction()); | 210 CHECK(func_value->IsJSFunction()); |
211 function = JSFunction::cast(func_value); | 211 function = JSFunction::cast(func_value); |
212 | 212 |
213 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); | 213 obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked()); |
214 String* obj_name = | 214 String* obj_name = |
215 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 215 String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked()); |
216 Isolate::Current()->context()->global_object()->SetProperty( | 216 Isolate::Current()->context()->global_object()->SetProperty( |
217 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); | 217 obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked(); |
218 String* prop_name = | 218 String* prop_name = |
219 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); | 219 String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked()); |
220 obj->SetProperty(prop_name, | 220 obj->SetProperty(prop_name, |
221 Smi::FromInt(23), | 221 Smi::FromInt(23), |
222 NONE, | 222 NONE, |
223 kNonStrictMode)->ToObjectChecked(); | 223 kNonStrictMode)->ToObjectChecked(); |
224 | 224 |
225 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 225 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
226 | 226 |
227 obj_name = | 227 obj_name = |
228 String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked()); | 228 String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked()); |
229 CHECK(Isolate::Current()->context()->global_object()-> | 229 CHECK(Isolate::Current()->context()->global_object()-> |
230 HasLocalProperty(obj_name)); | 230 HasLocalProperty(obj_name)); |
231 CHECK(Isolate::Current()->context()->global_object()-> | 231 CHECK(Isolate::Current()->context()->global_object()-> |
232 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); | 232 GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); |
233 obj = JSObject::cast(Isolate::Current()->context()->global_object()-> | 233 obj = JSObject::cast(Isolate::Current()->context()->global_object()-> |
234 GetProperty(obj_name)->ToObjectChecked()); | 234 GetProperty(obj_name)->ToObjectChecked()); |
235 prop_name = | 235 prop_name = |
236 String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked()); | 236 String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked()); |
237 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); | 237 CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 // TODO(1600): compaction of map space is temporary removed from GC. | 241 // TODO(1600): compaction of map space is temporary removed from GC. |
242 #if 0 | 242 #if 0 |
243 static Handle<Map> CreateMap() { | 243 static Handle<Map> CreateMap() { |
244 return FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 244 return FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
245 } | 245 } |
246 | 246 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (v8::internal::Snapshot::IsEnabled()) { | 548 if (v8::internal::Snapshot::IsEnabled()) { |
549 CHECK_LE(delta, 2500 * 1024); // 2400. | 549 CHECK_LE(delta, 2500 * 1024); // 2400. |
550 } else { | 550 } else { |
551 CHECK_LE(delta, 2860 * 1024); // 2760. | 551 CHECK_LE(delta, 2860 * 1024); // 2760. |
552 } | 552 } |
553 } | 553 } |
554 } | 554 } |
555 } | 555 } |
556 | 556 |
557 #endif // __linux__ and !USE_SIMULATOR | 557 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |