Chromium Code Reviews| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 // slow properties mode for now. We don't go in the map cache because | 227 // slow properties mode for now. We don't go in the map cache because |
| 228 // maps with constant functions can't be shared if the functions are | 228 // maps with constant functions can't be shared if the functions are |
| 229 // not the same (which is the common case). | 229 // not the same (which is the common case). |
| 230 bool is_result_from_cache = false; | 230 bool is_result_from_cache = false; |
| 231 Handle<Map> map = has_function_literal | 231 Handle<Map> map = has_function_literal |
| 232 ? Handle<Map>(context->object_function()->initial_map()) | 232 ? Handle<Map>(context->object_function()->initial_map()) |
| 233 : ComputeObjectLiteralMap(context, | 233 : ComputeObjectLiteralMap(context, |
| 234 constant_properties, | 234 constant_properties, |
| 235 &is_result_from_cache); | 235 &is_result_from_cache); |
| 236 | 236 |
| 237 Handle<JSObject> boilerplate = | 237 Factory* factory = isolate->factory(); |
|
danno
2013/05/07 13:04:47
Don't need this change.
Toon Verwaest
2013/05/07 15:08:52
Done.
| |
| 238 isolate->factory()->NewJSObjectFromMap( | 238 Handle<JSObject> boilerplate = factory->NewJSObjectFromMap( |
| 239 map, isolate->heap()->GetPretenureMode()); | 239 map, isolate->heap()->GetPretenureMode()); |
| 240 | 240 |
| 241 // Normalize the elements of the boilerplate to save space if needed. | 241 // Normalize the elements of the boilerplate to save space if needed. |
| 242 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); | 242 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); |
| 243 | 243 |
| 244 // Add the constant properties to the boilerplate. | 244 // Add the constant properties to the boilerplate. |
| 245 int length = constant_properties->length(); | 245 int length = constant_properties->length(); |
| 246 bool should_transform = | 246 bool should_transform = |
| 247 !is_result_from_cache && boilerplate->HasFastProperties(); | 247 !is_result_from_cache && boilerplate->HasFastProperties(); |
| 248 if (should_transform || has_function_literal) { | 248 if (should_transform || has_function_literal) { |
| 249 // Normalize the properties of object to avoid n^2 behavior | 249 // Normalize the properties of object to avoid n^2 behavior |
| (...skipping 13144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13394 // Handle last resort GC and make sure to allow future allocations | 13394 // Handle last resort GC and make sure to allow future allocations |
| 13395 // to grow the heap without causing GCs (if possible). | 13395 // to grow the heap without causing GCs (if possible). |
| 13396 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13396 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13397 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13397 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13398 "Runtime::PerformGC"); | 13398 "Runtime::PerformGC"); |
| 13399 } | 13399 } |
| 13400 } | 13400 } |
| 13401 | 13401 |
| 13402 | 13402 |
| 13403 } } // namespace v8::internal | 13403 } } // namespace v8::internal |
| OLD | NEW |