Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1492243003: [proxies] InstanceOfStub should bailout to %HasInPrototypeChain for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips/mips64. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2531 __ bind(&function_prototype_valid); 2531 __ bind(&function_prototype_valid);
2532 __ AssertNotSmi(function_prototype); 2532 __ AssertNotSmi(function_prototype);
2533 2533
2534 // Update the global instanceof cache with the current {object} map and 2534 // Update the global instanceof cache with the current {object} map and
2535 // {function}. The cached answer will be set when it is known below. 2535 // {function}. The cached answer will be set when it is known below.
2536 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); 2536 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
2537 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); 2537 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
2538 2538
2539 // Loop through the prototype chain looking for the {function} prototype. 2539 // Loop through the prototype chain looking for the {function} prototype.
2540 // Assume true, and change to false if not found. 2540 // Assume true, and change to false if not found.
2541 Register const object_prototype = object_map; 2541 Label done, loop, proxy_case;
2542 Label done, loop;
2543 __ LoadRoot(rax, Heap::kTrueValueRootIndex); 2542 __ LoadRoot(rax, Heap::kTrueValueRootIndex);
2544 __ bind(&loop); 2543 __ bind(&loop);
2545 __ movp(object_prototype, FieldOperand(object_map, Map::kPrototypeOffset)); 2544 __ CmpInstanceType(object_map, JS_PROXY_TYPE);
2546 __ cmpp(object_prototype, function_prototype); 2545 __ j(equal, &proxy_case, Label::kNear);
2546 __ movp(object, FieldOperand(object_map, Map::kPrototypeOffset));
2547 __ cmpp(object, function_prototype);
2547 __ j(equal, &done, Label::kNear); 2548 __ j(equal, &done, Label::kNear);
2548 __ CompareRoot(object_prototype, Heap::kNullValueRootIndex); 2549 __ CompareRoot(object, Heap::kNullValueRootIndex);
2549 __ movp(object_map, FieldOperand(object_prototype, HeapObject::kMapOffset)); 2550 __ movp(object_map, FieldOperand(object, HeapObject::kMapOffset));
2550 __ j(not_equal, &loop); 2551 __ j(not_equal, &loop);
2551 __ LoadRoot(rax, Heap::kFalseValueRootIndex); 2552 __ LoadRoot(rax, Heap::kFalseValueRootIndex);
2552 __ bind(&done); 2553 __ bind(&done);
2553 __ StoreRoot(rax, Heap::kInstanceofCacheAnswerRootIndex); 2554 __ StoreRoot(rax, Heap::kInstanceofCacheAnswerRootIndex);
2554 __ ret(0); 2555 __ ret(0);
2555 2556
2556 // Slow-case: Call the runtime function. 2557 // Proxy-case: Call the %HasInPrototypeChain runtime function.
2558 __ bind(&proxy_case);
2559 __ PopReturnAddressTo(kScratchRegister);
2560 __ Push(object);
2561 __ Push(function_prototype);
2562 __ PushReturnAddressFrom(kScratchRegister);
2563 // Invalidate the instanceof cache.
2564 __ Move(rax, Smi::FromInt(0));
2565 __ StoreRoot(rax, Heap::kInstanceofCacheFunctionRootIndex);
2566 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
2567
2568 // Slow-case: Call the %InstanceOf runtime function.
2557 __ bind(&slow_case); 2569 __ bind(&slow_case);
2558 __ PopReturnAddressTo(kScratchRegister); 2570 __ PopReturnAddressTo(kScratchRegister);
2559 __ Push(object); 2571 __ Push(object);
2560 __ Push(function); 2572 __ Push(function);
2561 __ PushReturnAddressFrom(kScratchRegister); 2573 __ PushReturnAddressFrom(kScratchRegister);
2562 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 2574 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
2563 } 2575 }
2564 2576
2565 2577
2566 // ------------------------------------------------------------------------- 2578 // -------------------------------------------------------------------------
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
5401 kStackSpace, nullptr, return_value_operand, NULL); 5413 kStackSpace, nullptr, return_value_operand, NULL);
5402 } 5414 }
5403 5415
5404 5416
5405 #undef __ 5417 #undef __
5406 5418
5407 } // namespace internal 5419 } // namespace internal
5408 } // namespace v8 5420 } // namespace v8
5409 5421
5410 #endif // V8_TARGET_ARCH_X64 5422 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698