aboutsummaryrefslogtreecommitdiff
path: root/src/x64/codegen-x64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/x64/codegen-x64.cc')
-rw-r--r--src/x64/codegen-x64.cc50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index e0e40950..5abf3c83 100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -568,10 +568,10 @@ void CodeGenerator::Load(Expression* expr) {
void CodeGenerator::LoadGlobal() {
if (in_spilled_code()) {
- frame_->EmitPush(GlobalObject());
+ frame_->EmitPush(GlobalObjectOperand());
} else {
Result temp = allocator_->Allocate();
- __ movq(temp.reg(), GlobalObject());
+ __ movq(temp.reg(), GlobalObjectOperand());
frame_->Push(&temp);
}
}
@@ -580,7 +580,7 @@ void CodeGenerator::LoadGlobal() {
void CodeGenerator::LoadGlobalReceiver() {
Result temp = allocator_->Allocate();
Register reg = temp.reg();
- __ movq(reg, GlobalObject());
+ __ movq(reg, GlobalObjectOperand());
__ movq(reg, FieldOperand(reg, GlobalObject::kGlobalReceiverOffset));
frame_->Push(&temp);
}
@@ -4244,7 +4244,8 @@ void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) {
void CodeGenerator::InstantiateFunction(
- Handle<SharedFunctionInfo> function_info) {
+ Handle<SharedFunctionInfo> function_info,
+ bool pretenure) {
// The inevitable call will sync frame elements to memory anyway, so
// we do it eagerly to allow us to push the arguments directly into
// place.
@@ -4252,7 +4253,9 @@ void CodeGenerator::InstantiateFunction(
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
- if (scope()->is_function_scope() && function_info->num_literals() == 0) {
+ if (scope()->is_function_scope() &&
+ function_info->num_literals() == 0 &&
+ !pretenure) {
FastNewClosureStub stub;
frame_->Push(function_info);
Result answer = frame_->CallStub(&stub, 1);
@@ -4262,7 +4265,10 @@ void CodeGenerator::InstantiateFunction(
// shared function info.
frame_->EmitPush(rsi);
frame_->EmitPush(function_info);
- Result result = frame_->CallRuntime(Runtime::kNewClosure, 2);
+ frame_->EmitPush(pretenure
+ ? Factory::true_value()
+ : Factory::false_value());
+ Result result = frame_->CallRuntime(Runtime::kNewClosure, 3);
frame_->Push(&result);
}
}
@@ -4279,14 +4285,14 @@ void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
SetStackOverflow();
return;
}
- InstantiateFunction(function_info);
+ InstantiateFunction(function_info, node->pretenure());
}
void CodeGenerator::VisitSharedFunctionInfoLiteral(
SharedFunctionInfoLiteral* node) {
Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
- InstantiateFunction(node->shared_function_info());
+ InstantiateFunction(node->shared_function_info(), false);
}
@@ -5592,6 +5598,18 @@ void CodeGenerator::VisitCall(Call* node) {
// Push the receiver onto the frame.
Load(property->obj());
+ // Load the name of the function.
+ Load(property->key());
+
+ // Swap the name of the function and the receiver on the stack to follow
+ // the calling convention for call ICs.
+ Result key = frame_->Pop();
+ Result receiver = frame_->Pop();
+ frame_->Push(&key);
+ frame_->Push(&receiver);
+ key.Unuse();
+ receiver.Unuse();
+
// Load the arguments.
int arg_count = args->length();
for (int i = 0; i < arg_count; i++) {
@@ -5599,14 +5617,13 @@ void CodeGenerator::VisitCall(Call* node) {
frame_->SpillTop();
}
- // Load the name of the function.
- Load(property->key());
-
- // Call the IC initialization code.
+ // Place the key on top of stack and call the IC initialization code.
+ frame_->PushElementAt(arg_count + 1);
CodeForSourcePosition(node->position());
Result result = frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET,
arg_count,
loop_nesting());
+ frame_->Drop(); // Drop the key still on the stack.
frame_->RestoreContextRegister();
frame_->Push(&result);
}
@@ -6062,7 +6079,7 @@ class DeferredIsStringWrapperSafeForDefaultValueOf : public DeferredCode {
__ movq(scratch2_,
FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset));
__ cmpq(scratch1_,
- CodeGenerator::ContextOperand(
+ ContextOperand(
scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
__ j(not_equal, &false_result);
// Set the bit in the map to indicate that it has been checked safe for
@@ -7206,6 +7223,11 @@ void CodeGenerator::GenerateGetCachedArrayIndex(ZoneList<Expression*>* args) {
}
+void CodeGenerator::GenerateFastAsciiArrayJoin(ZoneList<Expression*>* args) {
+ frame_->Push(Factory::undefined_value());
+}
+
+
void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
if (CheckForInlineRuntimeCall(node)) {
return;
@@ -7219,7 +7241,7 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
// Push the builtins object found in the current global object.
Result temp = allocator()->Allocate();
ASSERT(temp.is_valid());
- __ movq(temp.reg(), GlobalObject());
+ __ movq(temp.reg(), GlobalObjectOperand());
__ movq(temp.reg(),
FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset));
frame_->Push(&temp);