Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index 620dce988c55a9df27ec3929d82d18911f0b4815..0f205c144af2b67703d7007a0ab61ca566d0aa9f 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -2430,25 +2430,16 @@ Handle<Code> CallStubCompiler::CompileFastApiCall( |
} |
-Handle<Code> CallStubCompiler::CompileCallConstant(Handle<Object> object, |
- Handle<JSObject> holder, |
- Handle<JSFunction> function, |
- Handle<String> name, |
- CheckType check) { |
+void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object, |
+ Handle<JSObject> holder, |
+ Handle<String> name, |
+ CheckType check, |
+ Label* success) { |
// ----------- S t a t e ------------- |
// -- a2 : name |
// -- ra : return address |
// ----------------------------------- |
- if (HasCustomCallGenerator(function)) { |
- Handle<Code> code = CompileCustomCall(object, holder, |
- Handle<JSGlobalPropertyCell>::null(), |
- function, name); |
- // A null handle means bail out to the regular compiler code below. |
- if (!code.is_null()) return code; |
- } |
- |
Label miss; |
- |
GenerateNameCheck(name, &miss); |
// Get the receiver from the stack. |
@@ -2481,77 +2472,87 @@ Handle<Code> CallStubCompiler::CompileCallConstant(Handle<Object> object, |
break; |
case STRING_CHECK: |
- if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { |
- // Check that the object is a two-byte string or a symbol. |
- __ GetObjectType(a1, a3, a3); |
- __ Branch(&miss, Ugreater_equal, a3, Operand(FIRST_NONSTRING_TYPE)); |
- // Check that the maps starting from the prototype haven't changed. |
- GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::STRING_FUNCTION_INDEX, a0, &miss); |
- CheckPrototypes( |
- Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
- a0, holder, a3, a1, t0, name, &miss); |
- } else { |
- // Calling non-strict non-builtins with a value as the receiver |
- // requires boxing. |
- __ jmp(&miss); |
- } |
+ // Check that the object is a two-byte string or a symbol. |
+ __ GetObjectType(a1, a3, a3); |
+ __ Branch(&miss, Ugreater_equal, a3, Operand(FIRST_NONSTRING_TYPE)); |
+ // Check that the maps starting from the prototype haven't changed. |
+ GenerateDirectLoadGlobalFunctionPrototype( |
+ masm(), Context::STRING_FUNCTION_INDEX, a0, &miss); |
+ CheckPrototypes( |
+ Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
+ a0, holder, a3, a1, t0, name, &miss); |
break; |
- case NUMBER_CHECK: |
- if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { |
+ case NUMBER_CHECK: { |
Label fast; |
- // Check that the object is a smi or a heap number. |
- __ JumpIfSmi(a1, &fast); |
- __ GetObjectType(a1, a0, a0); |
- __ Branch(&miss, ne, a0, Operand(HEAP_NUMBER_TYPE)); |
- __ bind(&fast); |
- // Check that the maps starting from the prototype haven't changed. |
- GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss); |
- CheckPrototypes( |
- Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
- a0, holder, a3, a1, t0, name, &miss); |
- } else { |
- // Calling non-strict non-builtins with a value as the receiver |
- // requires boxing. |
- __ jmp(&miss); |
- } |
+ // Check that the object is a smi or a heap number. |
+ __ JumpIfSmi(a1, &fast); |
+ __ GetObjectType(a1, a0, a0); |
+ __ Branch(&miss, ne, a0, Operand(HEAP_NUMBER_TYPE)); |
+ __ bind(&fast); |
+ // Check that the maps starting from the prototype haven't changed. |
+ GenerateDirectLoadGlobalFunctionPrototype( |
+ masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss); |
+ CheckPrototypes( |
+ Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
+ a0, holder, a3, a1, t0, name, &miss); |
break; |
- |
- case BOOLEAN_CHECK: |
- if (function->IsBuiltin() || !function->shared()->is_classic_mode()) { |
- Label fast; |
- // Check that the object is a boolean. |
- __ LoadRoot(t0, Heap::kTrueValueRootIndex); |
- __ Branch(&fast, eq, a1, Operand(t0)); |
- __ LoadRoot(t0, Heap::kFalseValueRootIndex); |
- __ Branch(&miss, ne, a1, Operand(t0)); |
- __ bind(&fast); |
- // Check that the maps starting from the prototype haven't changed. |
- GenerateDirectLoadGlobalFunctionPrototype( |
- masm(), Context::BOOLEAN_FUNCTION_INDEX, a0, &miss); |
- CheckPrototypes( |
- Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
- a0, holder, a3, a1, t0, name, &miss); |
- } else { |
- // Calling non-strict non-builtins with a value as the receiver |
- // requires boxing. |
- __ jmp(&miss); |
- } |
+ } |
+ case BOOLEAN_CHECK: { |
+ Label fast; |
+ // Check that the object is a boolean. |
+ __ LoadRoot(t0, Heap::kTrueValueRootIndex); |
+ __ Branch(&fast, eq, a1, Operand(t0)); |
+ __ LoadRoot(t0, Heap::kFalseValueRootIndex); |
+ __ Branch(&miss, ne, a1, Operand(t0)); |
+ __ bind(&fast); |
+ // Check that the maps starting from the prototype haven't changed. |
+ GenerateDirectLoadGlobalFunctionPrototype( |
+ masm(), Context::BOOLEAN_FUNCTION_INDEX, a0, &miss); |
+ CheckPrototypes( |
+ Handle<JSObject>(JSObject::cast(object->GetPrototype())), |
+ a0, holder, a3, a1, t0, name, &miss); |
break; |
} |
+ } |
+ |
+ __ jmp(success); |
+ |
+ // Handle call cache miss. |
+ __ bind(&miss); |
+ |
+ GenerateMissBranch(); |
+} |
+ |
+void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { |
CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
? CALL_AS_FUNCTION |
: CALL_AS_METHOD; |
__ InvokeFunction( |
function, arguments(), JUMP_FUNCTION, NullCallWrapper(), call_kind); |
+} |
- // Handle call cache miss. |
- __ bind(&miss); |
- GenerateMissBranch(); |
+Handle<Code> CallStubCompiler::CompileCallConstant( |
+ Handle<Object> object, |
+ Handle<JSObject> holder, |
+ Handle<String> name, |
+ CheckType check, |
+ Handle<JSFunction> function) { |
+ if (HasCustomCallGenerator(function)) { |
+ Handle<Code> code = CompileCustomCall(object, holder, |
+ Handle<JSGlobalPropertyCell>::null(), |
+ function, name); |
+ // A null handle means bail out to the regular compiler code below. |
+ if (!code.is_null()) return code; |
+ } |
+ |
+ Label success; |
+ |
+ CompileHandlerFrontend(object, holder, name, check, &success); |
+ __ bind(&success); |
+ CompileHandlerBackend(function); |
// Return the generated code. |
return GetCode(function); |