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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 | 1445 |
1446 | 1446 |
1447 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1447 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1448 Comment cmnt(masm_, "[ ObjectLiteral"); | 1448 Comment cmnt(masm_, "[ ObjectLiteral"); |
1449 | 1449 |
1450 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1450 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1451 int flags = expr->ComputeFlags(); | 1451 int flags = expr->ComputeFlags(); |
1452 // If any of the keys would store to the elements array, then we shouldn't | 1452 // If any of the keys would store to the elements array, then we shouldn't |
1453 // allow it. | 1453 // allow it. |
1454 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1454 if (MustCreateObjectLiteralWithRuntime(expr)) { |
1455 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1455 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1456 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); | |
1457 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1456 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1458 __ push(Immediate(constant_properties)); | 1457 __ push(Immediate(constant_properties)); |
1459 __ push(Immediate(Smi::FromInt(flags))); | 1458 __ push(Immediate(Smi::FromInt(flags))); |
1460 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1459 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1461 } else { | 1460 } else { |
1462 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1461 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1463 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset)); | |
1464 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1462 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
1465 __ mov(ecx, Immediate(constant_properties)); | 1463 __ mov(ecx, Immediate(constant_properties)); |
1466 __ mov(edx, Immediate(Smi::FromInt(flags))); | 1464 __ mov(edx, Immediate(Smi::FromInt(flags))); |
1467 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); | 1465 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); |
1468 __ CallStub(&stub); | 1466 __ CallStub(&stub); |
1469 } | 1467 } |
1470 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1468 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1471 | 1469 |
1472 // If result_saved is true the result is on top of the stack. If | 1470 // If result_saved is true the result is on top of the stack. If |
1473 // result_saved is false the result is in eax. | 1471 // result_saved is false the result is in eax. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 IsFastObjectElementsKind(expr->constant_elements_kind()); | 1640 IsFastObjectElementsKind(expr->constant_elements_kind()); |
1643 | 1641 |
1644 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1642 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1645 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1643 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1646 // If the only customer of allocation sites is transitioning, then | 1644 // If the only customer of allocation sites is transitioning, then |
1647 // we can turn it off if we don't have anywhere else to transition to. | 1645 // we can turn it off if we don't have anywhere else to transition to. |
1648 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1646 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1649 } | 1647 } |
1650 | 1648 |
1651 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1649 if (MustCreateArrayLiteralWithRuntime(expr)) { |
1652 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1650 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1653 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | |
1654 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1651 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1655 __ push(Immediate(constant_elements)); | 1652 __ push(Immediate(constant_elements)); |
1656 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); | 1653 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); |
1657 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1654 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1658 } else { | 1655 } else { |
1659 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1656 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1660 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset)); | |
1661 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); | 1657 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
1662 __ mov(ecx, Immediate(constant_elements)); | 1658 __ mov(ecx, Immediate(constant_elements)); |
1663 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1659 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); |
1664 __ CallStub(&stub); | 1660 __ CallStub(&stub); |
1665 } | 1661 } |
1666 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1662 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1667 | 1663 |
1668 bool result_saved = false; // Is the result saved to the stack? | 1664 bool result_saved = false; // Is the result saved to the stack? |
1669 ZoneList<Expression*>* subexprs = expr->values(); | 1665 ZoneList<Expression*>* subexprs = expr->values(); |
1670 int length = subexprs->length(); | 1666 int length = subexprs->length(); |
(...skipping 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4908 Assembler::target_address_at(call_target_address, | 4904 Assembler::target_address_at(call_target_address, |
4909 unoptimized_code)); | 4905 unoptimized_code)); |
4910 return OSR_AFTER_STACK_CHECK; | 4906 return OSR_AFTER_STACK_CHECK; |
4911 } | 4907 } |
4912 | 4908 |
4913 | 4909 |
4914 } // namespace internal | 4910 } // namespace internal |
4915 } // namespace v8 | 4911 } // namespace v8 |
4916 | 4912 |
4917 #endif // V8_TARGET_ARCH_X87 | 4913 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |