Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index 47428a8324248e0d892e0e3f1c870084a96dae3b..c76a409ce746d0113b95fb14c469f31e60fa140b 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -472,7 +472,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 ------------- |
// -- a0: receiver |
// -- a1: function to call |
@@ -490,7 +491,10 @@ static void GenerateCallFunction(MacroAssembler* masm, |
} |
// Invoke the function. |
- __ InvokeFunction(a1, arguments, JUMP_FUNCTION); |
+ CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) |
+ ? CALL_AS_FUNCTION |
+ : CALL_AS_METHOD; |
+ __ InvokeFunction(a1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); |
} |
@@ -629,10 +633,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, |
@@ -760,8 +766,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. |
@@ -844,6 +853,7 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
StubCompiler* stub_compiler_; |
const ParameterCount& arguments_; |
Register name_; |
+ Code::ExtraICState extra_ic_state_; |
}; |
@@ -1503,7 +1513,7 @@ MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
Register reg = CheckPrototypes(object, a0, holder, a1, a3, t0, name, &miss); |
GenerateFastPropertyLoad(masm(), a1, reg, holder, index); |
- GenerateCallFunction(masm(), object, arguments(), &miss); |
+ GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); |
// Handle call cache miss. |
__ bind(&miss); |
@@ -2001,7 +2011,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); |
// a2: function name. |
@@ -2137,7 +2147,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); |
// a2: function name. |
@@ -2239,7 +2249,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); |
// a2: function name. |
@@ -2425,7 +2435,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); |
@@ -2459,7 +2472,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
// Get the receiver from the stack. |
__ lw(a1, MemOperand(sp, argc * kPointerSize)); |
- CallInterceptorCompiler compiler(this, arguments(), a2); |
+ CallInterceptorCompiler compiler(this, arguments(), a2, extra_ic_state_); |
MaybeObject* result = compiler.Compile(masm(), |
object, |
holder, |
@@ -2479,7 +2492,7 @@ MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
// Restore receiver. |
__ lw(a0, MemOperand(sp, argc * kPointerSize)); |
- GenerateCallFunction(masm(), object, arguments(), &miss); |
+ GenerateCallFunction(masm(), object, arguments(), &miss, extra_ic_state_); |
// Handle call cache miss. |
__ bind(&miss); |
@@ -2491,13 +2504,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 ------------- |
// -- a2 : name |
// -- ra : return address |
@@ -2538,7 +2549,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()) { |