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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 } | 1479 } |
1480 } | 1480 } |
1481 | 1481 |
1482 | 1482 |
1483 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1483 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1484 Comment cmnt(masm_, "[ ObjectLiteral"); | 1484 Comment cmnt(masm_, "[ ObjectLiteral"); |
1485 | 1485 |
1486 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1486 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1487 int flags = expr->ComputeFlags(); | 1487 int flags = expr->ComputeFlags(); |
1488 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1488 if (MustCreateObjectLiteralWithRuntime(expr)) { |
1489 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1489 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1490 __ Push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); | |
1491 __ Push(Smi::FromInt(expr->literal_index())); | 1490 __ Push(Smi::FromInt(expr->literal_index())); |
1492 __ Push(constant_properties); | 1491 __ Push(constant_properties); |
1493 __ Push(Smi::FromInt(flags)); | 1492 __ Push(Smi::FromInt(flags)); |
1494 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1493 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1495 } else { | 1494 } else { |
1496 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1495 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1497 __ movp(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset)); | |
1498 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1496 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
1499 __ Move(rcx, constant_properties); | 1497 __ Move(rcx, constant_properties); |
1500 __ Move(rdx, Smi::FromInt(flags)); | 1498 __ Move(rdx, Smi::FromInt(flags)); |
1501 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); | 1499 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); |
1502 __ CallStub(&stub); | 1500 __ CallStub(&stub); |
1503 } | 1501 } |
1504 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1502 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1505 | 1503 |
1506 // If result_saved is true the result is on top of the stack. If | 1504 // If result_saved is true the result is on top of the stack. If |
1507 // result_saved is false the result is in rax. | 1505 // result_saved is false the result is in rax. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 IsFastObjectElementsKind(expr->constant_elements_kind()); | 1673 IsFastObjectElementsKind(expr->constant_elements_kind()); |
1676 | 1674 |
1677 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1675 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1678 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1676 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1679 // If the only customer of allocation sites is transitioning, then | 1677 // If the only customer of allocation sites is transitioning, then |
1680 // we can turn it off if we don't have anywhere else to transition to. | 1678 // we can turn it off if we don't have anywhere else to transition to. |
1681 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1679 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1682 } | 1680 } |
1683 | 1681 |
1684 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1682 if (MustCreateArrayLiteralWithRuntime(expr)) { |
1685 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1683 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1686 __ Push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); | |
1687 __ Push(Smi::FromInt(expr->literal_index())); | 1684 __ Push(Smi::FromInt(expr->literal_index())); |
1688 __ Push(constant_elements); | 1685 __ Push(constant_elements); |
1689 __ Push(Smi::FromInt(expr->ComputeFlags())); | 1686 __ Push(Smi::FromInt(expr->ComputeFlags())); |
1690 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1687 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1691 } else { | 1688 } else { |
1692 __ movp(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1689 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1693 __ movp(rax, FieldOperand(rbx, JSFunction::kLiteralsOffset)); | |
1694 __ Move(rbx, Smi::FromInt(expr->literal_index())); | 1690 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
1695 __ Move(rcx, constant_elements); | 1691 __ Move(rcx, constant_elements); |
1696 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1692 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); |
1697 __ CallStub(&stub); | 1693 __ CallStub(&stub); |
1698 } | 1694 } |
1699 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1695 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1700 | 1696 |
1701 bool result_saved = false; // Is the result saved to the stack? | 1697 bool result_saved = false; // Is the result saved to the stack? |
1702 ZoneList<Expression*>* subexprs = expr->values(); | 1698 ZoneList<Expression*>* subexprs = expr->values(); |
1703 int length = subexprs->length(); | 1699 int length = subexprs->length(); |
(...skipping 3227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4931 Assembler::target_address_at(call_target_address, | 4927 Assembler::target_address_at(call_target_address, |
4932 unoptimized_code)); | 4928 unoptimized_code)); |
4933 return OSR_AFTER_STACK_CHECK; | 4929 return OSR_AFTER_STACK_CHECK; |
4934 } | 4930 } |
4935 | 4931 |
4936 | 4932 |
4937 } // namespace internal | 4933 } // namespace internal |
4938 } // namespace v8 | 4934 } // namespace v8 |
4939 | 4935 |
4940 #endif // V8_TARGET_ARCH_X64 | 4936 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |