Index: src/x64/fast-codegen-x64.cc |
=================================================================== |
--- src/x64/fast-codegen-x64.cc (revision 3430) |
+++ src/x64/fast-codegen-x64.cc (working copy) |
@@ -663,31 +663,14 @@ |
void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
Comment cmnt(masm_, "[ ObjectLiteral"); |
- Label boilerplate_exists; |
- |
__ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
- __ movq(rbx, FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
- int literal_offset = |
- FixedArray::kHeaderSize + expr->literal_index() * kPointerSize; |
- __ movq(rax, FieldOperand(rbx, literal_offset)); |
- __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
- __ j(not_equal, &boilerplate_exists); |
- // Create boilerplate if it does not exist. |
- // Literal array (0). |
- __ push(rbx); |
- // Literal index (1). |
+ __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
__ Push(Smi::FromInt(expr->literal_index())); |
- // Constant properties (2). |
__ Push(expr->constant_properties()); |
- __ CallRuntime(Runtime::kCreateObjectLiteralBoilerplate, 3); |
- __ bind(&boilerplate_exists); |
- // rax contains boilerplate. |
- // Clone boilerplate. |
- __ push(rax); |
- if (expr->depth() == 1) { |
- __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); |
+ if (expr->depth() > 1) { |
+ __ CallRuntime(Runtime::kCreateObjectLiteral, 3); |
} else { |
- __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); |
+ __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 3); |
} |
// If result_saved == true: The result is saved on top of the |
@@ -783,31 +766,14 @@ |
void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
Comment cmnt(masm_, "[ ArrayLiteral"); |
- Label make_clone; |
- |
- // Fetch the function's literals array. |
__ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
- __ movq(rbx, FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
- // Check if the literal's boilerplate has been instantiated. |
- int offset = |
- FixedArray::kHeaderSize + (expr->literal_index() * kPointerSize); |
- __ movq(rax, FieldOperand(rbx, offset)); |
- __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
- __ j(not_equal, &make_clone); |
- |
- // Instantiate the boilerplate. |
- __ push(rbx); |
+ __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
__ Push(Smi::FromInt(expr->literal_index())); |
__ Push(expr->literals()); |
- __ CallRuntime(Runtime::kCreateArrayLiteralBoilerplate, 3); |
- |
- __ bind(&make_clone); |
- // Clone the boilerplate. |
- __ push(rax); |
if (expr->depth() > 1) { |
- __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); |
+ __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
} else { |
- __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); |
+ __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
} |
bool result_saved = false; // Is the result saved to the stack? |