OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 IfBuilder checker(this); | 409 IfBuilder checker(this); |
410 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, | 410 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, |
411 undefined); | 411 undefined); |
412 checker.And(); | 412 checker.And(); |
413 | 413 |
414 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( | 414 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( |
415 AllocationSite::kTransitionInfoOffset); | 415 AllocationSite::kTransitionInfoOffset); |
416 HInstruction* boilerplate = Add<HLoadNamedField>( | 416 HInstruction* boilerplate = Add<HLoadNamedField>( |
417 allocation_site, static_cast<HValue*>(NULL), access); | 417 allocation_site, static_cast<HValue*>(NULL), access); |
418 | 418 |
419 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 419 int length = casted_stub()->length(); |
| 420 if (length == 0) { |
| 421 // Empty objects have some slack added to them. |
| 422 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount; |
| 423 } |
| 424 int size = JSObject::kHeaderSize + length * kPointerSize; |
420 int object_size = size; | 425 int object_size = size; |
421 if (FLAG_allocation_site_pretenuring) { | 426 if (FLAG_allocation_site_pretenuring) { |
422 size += AllocationMemento::kSize; | 427 size += AllocationMemento::kSize; |
423 } | 428 } |
424 | 429 |
425 HValue* boilerplate_map = Add<HLoadNamedField>( | 430 HValue* boilerplate_map = Add<HLoadNamedField>( |
426 boilerplate, static_cast<HValue*>(NULL), | 431 boilerplate, static_cast<HValue*>(NULL), |
427 HObjectAccess::ForMap()); | 432 HObjectAccess::ForMap()); |
428 HValue* boilerplate_size = Add<HLoadNamedField>( | 433 HValue* boilerplate_size = Add<HLoadNamedField>( |
429 boilerplate_map, static_cast<HValue*>(NULL), | 434 boilerplate_map, static_cast<HValue*>(NULL), |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 | 2019 |
2015 // Probe the stub cache. | 2020 // Probe the stub cache. |
2016 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 2021 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
2017 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 2022 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
2018 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); | 2023 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); |
2019 | 2024 |
2020 // We never continue. | 2025 // We never continue. |
2021 return graph()->GetConstant0(); | 2026 return graph()->GetConstant0(); |
2022 } | 2027 } |
2023 } } // namespace v8::internal | 2028 } } // namespace v8::internal |
OLD | NEW |