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

Side by Side Diff: src/ia32/code-stubs-ia32.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/arm64/macro-assembler-arm64.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 __ bind(&function_prototype_valid); 2581 __ bind(&function_prototype_valid);
2582 __ AssertNotSmi(function_prototype); 2582 __ AssertNotSmi(function_prototype);
2583 2583
2584 // Update the global instanceof cache with the current {object} map and 2584 // Update the global instanceof cache with the current {object} map and
2585 // {function}. The cached answer will be set when it is known below. 2585 // {function}. The cached answer will be set when it is known below.
2586 __ StoreRoot(function, scratch, Heap::kInstanceofCacheFunctionRootIndex); 2586 __ StoreRoot(function, scratch, Heap::kInstanceofCacheFunctionRootIndex);
2587 __ StoreRoot(object_map, scratch, Heap::kInstanceofCacheMapRootIndex); 2587 __ StoreRoot(object_map, scratch, Heap::kInstanceofCacheMapRootIndex);
2588 2588
2589 // Loop through the prototype chain looking for the {function} prototype. 2589 // Loop through the prototype chain looking for the {function} prototype.
2590 // Assume true, and change to false if not found. 2590 // Assume true, and change to false if not found.
2591 Register const object_prototype = object_map; 2591 Label done, loop, proxy_case;
2592 Label done, loop;
2593 __ mov(eax, isolate()->factory()->true_value()); 2592 __ mov(eax, isolate()->factory()->true_value());
2594 __ bind(&loop); 2593 __ bind(&loop);
2595 __ mov(object_prototype, FieldOperand(object_map, Map::kPrototypeOffset)); 2594 __ CmpInstanceType(object_map, JS_PROXY_TYPE);
2596 __ cmp(object_prototype, function_prototype); 2595 __ j(equal, &proxy_case, Label::kNear);
2596 __ mov(object, FieldOperand(object_map, Map::kPrototypeOffset));
2597 __ cmp(object, function_prototype);
2597 __ j(equal, &done, Label::kNear); 2598 __ j(equal, &done, Label::kNear);
2598 __ cmp(object_prototype, isolate()->factory()->null_value()); 2599 __ cmp(object, isolate()->factory()->null_value());
2599 __ mov(object_map, FieldOperand(object_prototype, HeapObject::kMapOffset)); 2600 __ mov(object_map, FieldOperand(object, HeapObject::kMapOffset));
2600 __ j(not_equal, &loop); 2601 __ j(not_equal, &loop);
2601 __ mov(eax, isolate()->factory()->false_value()); 2602 __ mov(eax, isolate()->factory()->false_value());
2602 __ bind(&done); 2603 __ bind(&done);
2603 __ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex); 2604 __ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex);
2604 __ ret(0); 2605 __ ret(0);
2605 2606
2606 // Slow-case: Call the runtime function. 2607 // Proxy-case: Call the %HasInPrototypeChain runtime function.
2608 __ bind(&proxy_case);
2609 __ PopReturnAddressTo(scratch);
2610 __ Push(object);
2611 __ Push(function_prototype);
2612 __ PushReturnAddressFrom(scratch);
2613 // Invalidate the instanceof cache.
2614 __ Move(eax, Immediate(Smi::FromInt(0)));
2615 __ StoreRoot(eax, scratch, Heap::kInstanceofCacheFunctionRootIndex);
2616 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
2617
2618 // Slow-case: Call the %InstanceOf runtime function.
2607 __ bind(&slow_case); 2619 __ bind(&slow_case);
2608 __ pop(scratch); // Pop return address. 2620 __ PopReturnAddressTo(scratch);
2609 __ push(object); // Push {object}. 2621 __ Push(object);
2610 __ push(function); // Push {function}. 2622 __ Push(function);
2611 __ push(scratch); // Push return address. 2623 __ PushReturnAddressFrom(scratch);
2612 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 2624 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
2613 } 2625 }
2614 2626
2615 2627
2616 // ------------------------------------------------------------------------- 2628 // -------------------------------------------------------------------------
2617 // StringCharCodeAtGenerator 2629 // StringCharCodeAtGenerator
2618 2630
2619 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 2631 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
2620 // If the receiver is a smi trigger the non-string case. 2632 // If the receiver is a smi trigger the non-string case.
2621 STATIC_ASSERT(kSmiTag == 0); 2633 STATIC_ASSERT(kSmiTag == 0);
(...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after
5655 Operand(ebp, 7 * kPointerSize), NULL); 5667 Operand(ebp, 7 * kPointerSize), NULL);
5656 } 5668 }
5657 5669
5658 5670
5659 #undef __ 5671 #undef __
5660 5672
5661 } // namespace internal 5673 } // namespace internal
5662 } // namespace v8 5674 } // namespace v8
5663 5675
5664 #endif // V8_TARGET_ARCH_IA32 5676 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698