Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.cc

Issue 1469833005: [runtime] Pass closure to %CreateArrayLiteral and %CreateObjectLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_IA32 5 #if V8_TARGET_ARCH_IA32
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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1453
1454 1454
1455 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1455 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1456 Comment cmnt(masm_, "[ ObjectLiteral"); 1456 Comment cmnt(masm_, "[ ObjectLiteral");
1457 1457
1458 Handle<FixedArray> constant_properties = expr->constant_properties(); 1458 Handle<FixedArray> constant_properties = expr->constant_properties();
1459 int flags = expr->ComputeFlags(); 1459 int flags = expr->ComputeFlags();
1460 // If any of the keys would store to the elements array, then we shouldn't 1460 // If any of the keys would store to the elements array, then we shouldn't
1461 // allow it. 1461 // allow it.
1462 if (MustCreateObjectLiteralWithRuntime(expr)) { 1462 if (MustCreateObjectLiteralWithRuntime(expr)) {
1463 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1463 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1464 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset));
1465 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1464 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1466 __ push(Immediate(constant_properties)); 1465 __ push(Immediate(constant_properties));
1467 __ push(Immediate(Smi::FromInt(flags))); 1466 __ push(Immediate(Smi::FromInt(flags)));
1468 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1467 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1469 } else { 1468 } else {
1470 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1469 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1471 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset));
1472 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1470 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1473 __ mov(ecx, Immediate(constant_properties)); 1471 __ mov(ecx, Immediate(constant_properties));
1474 __ mov(edx, Immediate(Smi::FromInt(flags))); 1472 __ mov(edx, Immediate(Smi::FromInt(flags)));
1475 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); 1473 FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
1476 __ CallStub(&stub); 1474 __ CallStub(&stub);
1477 } 1475 }
1478 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1476 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1479 1477
1480 // If result_saved is true the result is on top of the stack. If 1478 // If result_saved is true the result is on top of the stack. If
1481 // result_saved is false the result is in eax. 1479 // result_saved is false the result is in eax.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 IsFastObjectElementsKind(expr->constant_elements_kind()); 1648 IsFastObjectElementsKind(expr->constant_elements_kind());
1651 1649
1652 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; 1650 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
1653 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { 1651 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) {
1654 // If the only customer of allocation sites is transitioning, then 1652 // If the only customer of allocation sites is transitioning, then
1655 // we can turn it off if we don't have anywhere else to transition to. 1653 // we can turn it off if we don't have anywhere else to transition to.
1656 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; 1654 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
1657 } 1655 }
1658 1656
1659 if (MustCreateArrayLiteralWithRuntime(expr)) { 1657 if (MustCreateArrayLiteralWithRuntime(expr)) {
1660 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1658 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1661 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1662 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1659 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1663 __ push(Immediate(constant_elements)); 1660 __ push(Immediate(constant_elements));
1664 __ push(Immediate(Smi::FromInt(expr->ComputeFlags()))); 1661 __ push(Immediate(Smi::FromInt(expr->ComputeFlags())));
1665 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); 1662 __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
1666 } else { 1663 } else {
1667 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1664 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1668 __ mov(eax, FieldOperand(ebx, JSFunction::kLiteralsOffset));
1669 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); 1665 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index())));
1670 __ mov(ecx, Immediate(constant_elements)); 1666 __ mov(ecx, Immediate(constant_elements));
1671 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); 1667 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode);
1672 __ CallStub(&stub); 1668 __ CallStub(&stub);
1673 } 1669 }
1674 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1670 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1675 1671
1676 bool result_saved = false; // Is the result saved to the stack? 1672 bool result_saved = false; // Is the result saved to the stack?
1677 ZoneList<Expression*>* subexprs = expr->values(); 1673 ZoneList<Expression*>* subexprs = expr->values();
1678 int length = subexprs->length(); 1674 int length = subexprs->length();
(...skipping 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4916 Assembler::target_address_at(call_target_address, 4912 Assembler::target_address_at(call_target_address,
4917 unoptimized_code)); 4913 unoptimized_code));
4918 return OSR_AFTER_STACK_CHECK; 4914 return OSR_AFTER_STACK_CHECK;
4919 } 4915 }
4920 4916
4921 4917
4922 } // namespace internal 4918 } // namespace internal
4923 } // namespace v8 4919 } // namespace v8
4924 4920
4925 #endif // V8_TARGET_ARCH_IA32 4921 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698