Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index cd2d376c370b9566984d0278b3f070f71c5e6793..6517602d6b4bef608b2d6fcba13b4656bb9bba71 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -476,7 +476,8 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
static void GenerateCallFunction(MacroAssembler* masm, |
Object* object, |
const ParameterCount& arguments, |
- Label* miss) { |
+ Label* miss, |
+ Code::ExtraICState extra_ic_state) { |
// ----------- S t a t e ------------- |
// -- r0: receiver |
// -- r1: function to call |
@@ -495,7 +496,10 @@ static void GenerateCallFunction(MacroAssembler* masm, |
} |
// Invoke the function. |
- __ InvokeFunction(r1, arguments, JUMP_FUNCTION); |
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
+ ? CALL_AS_FUNCTION |
+ : CALL_AS_METHOD; |
+ __ InvokeFunction(r1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); |
} |
@@ -625,10 +629,12 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
public: |
CallInterceptorCompiler(StubCompiler* stub_compiler, |
const ParameterCount& arguments, |
- Register name) |
+ Register name, |
+ Code::ExtraICState extra_ic_state) |
: stub_compiler_(stub_compiler), |
arguments_(arguments), |
- name_(name) {} |
+ name_(name), |
+ extra_ic_state_(extra_ic_state) {} |
MaybeObject* Compile(MacroAssembler* masm, |
JSObject* object, |
@@ -756,8 +762,11 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
arguments_.immediate()); |
if (result->IsFailure()) return result; |
} else { |
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) |
+ ? CALL_AS_FUNCTION |
+ : CALL_AS_METHOD; |
__ InvokeFunction(optimization.constant_function(), arguments_, |
- JUMP_FUNCTION); |
+ JUMP_FUNCTION, call_kind); |
} |
// Deferred code for fast API call case---clean preallocated space. |
@@ -839,6 +848,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
StubCompiler* stub_compiler_; |
const ParameterCount& arguments_; |
Register name_; |
+ Code::ExtraICState extra_ic_state_; |
}; |
@@ -1492,7 +1502,7 @@ MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); |
GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
- GenerateCallFunction(masm(), object, arguments(), &miss); |
+ GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); |
// Handle call cache miss. |
__ bind(&miss); |
@@ -1992,7 +2002,7 @@ MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
// Tail call the full function. We do not have to patch the receiver |
// because the function makes no use of it. |
__ bind(&slow); |
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD); |
__ bind(&miss); |
// r2: function name. |
@@ -2140,7 +2150,7 @@ MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
__ bind(&slow); |
// Tail call the full function. We do not have to patch the receiver |
// because the function makes no use of it. |
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD); |
__ bind(&miss); |
// r2: function name. |
@@ -2242,7 +2252,7 @@ MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
// Tail call the full function. We do not have to patch the receiver |
// because the function makes no use of it. |
__ bind(&slow); |
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD); |
__ bind(&miss); |
// r2: function name. |
@@ -2430,7 +2440,10 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, |
UNREACHABLE(); |
} |
- __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) |
+ ? CALL_AS_FUNCTION |
+ : CALL_AS_METHOD; |
+ __ InvokeFunction(function, arguments(), JUMP_FUNCTION, call_kind); |
// Handle call cache miss. |
__ bind(&miss); |
@@ -2463,7 +2476,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
// Get the receiver from the stack. |
__ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
- CallInterceptorCompiler compiler(this, arguments(), r2); |
+ CallInterceptorCompiler compiler(this, arguments(), r2, extra_ic_state_); |
MaybeObject* result = compiler.Compile(masm(), |
object, |
holder, |
@@ -2483,7 +2496,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
// Restore receiver. |
__ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
- GenerateCallFunction(masm(), object, arguments(), &miss); |
+ GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); |
// Handle call cache miss. |
__ bind(&miss); |
@@ -2495,13 +2508,11 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
} |
-MaybeObject* CallStubCompiler::CompileCallGlobal( |
- JSObject* object, |
- GlobalObject* holder, |
- JSGlobalPropertyCell* cell, |
- JSFunction* function, |
- String* name, |
- Code::ExtraICState extra_ic_state) { |
+MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
+ GlobalObject* holder, |
+ JSGlobalPropertyCell* cell, |
+ JSFunction* function, |
+ String* name) { |
// ----------- S t a t e ------------- |
// -- r2 : name |
// -- lr : return address |
@@ -2543,7 +2554,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal( |
ASSERT(function->is_compiled()); |
Handle<Code> code(function->code()); |
ParameterCount expected(function->shared()->formal_parameter_count()); |
- CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) |
? CALL_AS_FUNCTION |
: CALL_AS_METHOD; |
if (V8::UseCrankshaft()) { |