| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 82219a8ed18700240770e9132867ac81933aea5b..602d3a01a926e18ea923affd85d4d832fcb9f148 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -2002,125 +2002,6 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| -void InstanceOfStub::Generate(MacroAssembler* masm) {
|
| - Register const object = rdx; // Object (lhs).
|
| - Register const function = rax; // Function (rhs).
|
| - Register const object_map = rcx; // Map of {object}.
|
| - Register const function_map = r8; // Map of {function}.
|
| - Register const function_prototype = rdi; // Prototype of {function}.
|
| -
|
| - DCHECK(object.is(InstanceOfDescriptor::LeftRegister()));
|
| - DCHECK(function.is(InstanceOfDescriptor::RightRegister()));
|
| -
|
| - // Check if {object} is a smi.
|
| - Label object_is_smi;
|
| - __ JumpIfSmi(object, &object_is_smi, Label::kNear);
|
| -
|
| - // Lookup the {function} and the {object} map in the global instanceof cache.
|
| - // Note: This is safe because we clear the global instanceof cache whenever
|
| - // we change the prototype of any object.
|
| - Label fast_case, slow_case;
|
| - __ movp(object_map, FieldOperand(object, HeapObject::kMapOffset));
|
| - __ CompareRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
|
| - __ j(not_equal, &fast_case, Label::kNear);
|
| - __ CompareRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
|
| - __ j(not_equal, &fast_case, Label::kNear);
|
| - __ LoadRoot(rax, Heap::kInstanceofCacheAnswerRootIndex);
|
| - __ ret(0);
|
| -
|
| - // If {object} is a smi we can safely return false if {function} is a JS
|
| - // function, otherwise we have to miss to the runtime and throw an exception.
|
| - __ bind(&object_is_smi);
|
| - __ JumpIfSmi(function, &slow_case);
|
| - __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map);
|
| - __ j(not_equal, &slow_case);
|
| - __ LoadRoot(rax, Heap::kFalseValueRootIndex);
|
| - __ ret(0);
|
| -
|
| - // Fast-case: The {function} must be a valid JSFunction.
|
| - __ bind(&fast_case);
|
| - __ JumpIfSmi(function, &slow_case);
|
| - __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map);
|
| - __ j(not_equal, &slow_case);
|
| -
|
| - // Go to the runtime if the function is not a constructor.
|
| - __ testb(FieldOperand(function_map, Map::kBitFieldOffset),
|
| - Immediate(1 << Map::kIsConstructor));
|
| - __ j(zero, &slow_case);
|
| -
|
| - // Ensure that {function} has an instance prototype.
|
| - __ testb(FieldOperand(function_map, Map::kBitFieldOffset),
|
| - Immediate(1 << Map::kHasNonInstancePrototype));
|
| - __ j(not_zero, &slow_case);
|
| -
|
| - // Get the "prototype" (or initial map) of the {function}.
|
| - __ movp(function_prototype,
|
| - FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
|
| - __ AssertNotSmi(function_prototype);
|
| -
|
| - // Resolve the prototype if the {function} has an initial map. Afterwards the
|
| - // {function_prototype} will be either the JSReceiver prototype object or the
|
| - // hole value, which means that no instances of the {function} were created so
|
| - // far and hence we should return false.
|
| - Label function_prototype_valid;
|
| - Register const function_prototype_map = kScratchRegister;
|
| - __ CmpObjectType(function_prototype, MAP_TYPE, function_prototype_map);
|
| - __ j(not_equal, &function_prototype_valid, Label::kNear);
|
| - __ movp(function_prototype,
|
| - FieldOperand(function_prototype, Map::kPrototypeOffset));
|
| - __ bind(&function_prototype_valid);
|
| - __ AssertNotSmi(function_prototype);
|
| -
|
| - // Update the global instanceof cache with the current {object} map and
|
| - // {function}. The cached answer will be set when it is known below.
|
| - __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
|
| - __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
|
| -
|
| - // Loop through the prototype chain looking for the {function} prototype.
|
| - // Assume true, and change to false if not found.
|
| - Label done, loop, fast_runtime_fallback;
|
| - __ LoadRoot(rax, Heap::kTrueValueRootIndex);
|
| - __ bind(&loop);
|
| -
|
| - __ testb(FieldOperand(object_map, Map::kBitFieldOffset),
|
| - Immediate(1 << Map::kIsAccessCheckNeeded));
|
| - __ j(not_zero, &fast_runtime_fallback, Label::kNear);
|
| - __ CmpInstanceType(object_map, JS_PROXY_TYPE);
|
| - __ j(equal, &fast_runtime_fallback, Label::kNear);
|
| -
|
| - __ movp(object, FieldOperand(object_map, Map::kPrototypeOffset));
|
| - __ cmpp(object, function_prototype);
|
| - __ j(equal, &done, Label::kNear);
|
| - __ CompareRoot(object, Heap::kNullValueRootIndex);
|
| - __ movp(object_map, FieldOperand(object, HeapObject::kMapOffset));
|
| - __ j(not_equal, &loop);
|
| - __ LoadRoot(rax, Heap::kFalseValueRootIndex);
|
| - __ bind(&done);
|
| - __ StoreRoot(rax, Heap::kInstanceofCacheAnswerRootIndex);
|
| - __ ret(0);
|
| -
|
| - // Found Proxy or access check needed: Call the runtime.
|
| - __ bind(&fast_runtime_fallback);
|
| - __ PopReturnAddressTo(kScratchRegister);
|
| - __ Push(object);
|
| - __ Push(function_prototype);
|
| - __ PushReturnAddressFrom(kScratchRegister);
|
| - // Invalidate the instanceof cache.
|
| - __ Move(rax, Smi::FromInt(0));
|
| - __ StoreRoot(rax, Heap::kInstanceofCacheFunctionRootIndex);
|
| - __ TailCallRuntime(Runtime::kHasInPrototypeChain);
|
| -
|
| - // Slow-case: Call the %InstanceOf runtime function.
|
| - __ bind(&slow_case);
|
| - __ PopReturnAddressTo(kScratchRegister);
|
| - __ Push(object);
|
| - __ Push(function);
|
| - __ PushReturnAddressFrom(kScratchRegister);
|
| - __ TailCallRuntime(is_es6_instanceof() ? Runtime::kOrdinaryHasInstance
|
| - : Runtime::kInstanceOf);
|
| -}
|
| -
|
| -
|
| // -------------------------------------------------------------------------
|
| // StringCharCodeAtGenerator
|
|
|
|
|