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

Side by Side Diff: src/arm/code-stubs-arm.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 | « no previous file | src/arm64/code-stubs-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 __ bind(&function_prototype_valid); 1373 __ bind(&function_prototype_valid);
1374 __ AssertNotSmi(function_prototype); 1374 __ AssertNotSmi(function_prototype);
1375 1375
1376 // Update the global instanceof cache with the current {object} map and 1376 // Update the global instanceof cache with the current {object} map and
1377 // {function}. The cached answer will be set when it is known below. 1377 // {function}. The cached answer will be set when it is known below.
1378 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); 1378 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
1379 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); 1379 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
1380 1380
1381 // Loop through the prototype chain looking for the {function} prototype. 1381 // Loop through the prototype chain looking for the {function} prototype.
1382 // Assume true, and change to false if not found. 1382 // Assume true, and change to false if not found.
1383 Register const object_prototype = object_map; 1383 Register const object_instance_type = function_map;
1384 Register const null = scratch; 1384 Register const null = scratch;
1385 Label done, loop; 1385 Register const result = r0;
1386 __ LoadRoot(r0, Heap::kTrueValueRootIndex); 1386 Label done, loop, proxy_case;
1387 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1387 __ LoadRoot(null, Heap::kNullValueRootIndex); 1388 __ LoadRoot(null, Heap::kNullValueRootIndex);
1388 __ bind(&loop); 1389 __ bind(&loop);
1389 __ ldr(object_prototype, FieldMemOperand(object_map, Map::kPrototypeOffset)); 1390 __ CompareInstanceType(object_map, object_instance_type, JS_PROXY_TYPE);
1390 __ cmp(object_prototype, function_prototype); 1391 __ b(eq, &proxy_case);
1392 __ ldr(object, FieldMemOperand(object_map, Map::kPrototypeOffset));
1393 __ cmp(object, function_prototype);
1391 __ b(eq, &done); 1394 __ b(eq, &done);
1392 __ cmp(object_prototype, null); 1395 __ cmp(object, null);
1393 __ ldr(object_map, FieldMemOperand(object_prototype, HeapObject::kMapOffset)); 1396 __ ldr(object_map, FieldMemOperand(object, HeapObject::kMapOffset));
1394 __ b(ne, &loop); 1397 __ b(ne, &loop);
1395 __ LoadRoot(r0, Heap::kFalseValueRootIndex); 1398 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1396 __ bind(&done); 1399 __ bind(&done);
1397 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); 1400 __ StoreRoot(result, Heap::kInstanceofCacheAnswerRootIndex);
1398 __ Ret(); 1401 __ Ret();
1399 1402
1400 // Slow-case: Call the runtime function. 1403 // Proxy-case: Call the %HasInPrototypeChain runtime function.
1404 __ bind(&proxy_case);
1405 __ Push(object, function_prototype);
1406 // Invalidate the instanceof cache.
1407 __ Move(scratch, Smi::FromInt(0));
1408 __ StoreRoot(scratch, Heap::kInstanceofCacheFunctionRootIndex);
1409 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
1410
1411 // Slow-case: Call the %InstanceOf runtime function.
1401 __ bind(&slow_case); 1412 __ bind(&slow_case);
1402 __ Push(object, function); 1413 __ Push(object, function);
1403 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 1414 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
1404 } 1415 }
1405 1416
1406 1417
1407 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { 1418 void FunctionPrototypeStub::Generate(MacroAssembler* masm) {
1408 Label miss; 1419 Label miss;
1409 Register receiver = LoadDescriptor::ReceiverRegister(); 1420 Register receiver = LoadDescriptor::ReceiverRegister();
1410 // Ensure that the vector and slot registers won't be clobbered before 1421 // Ensure that the vector and slot registers won't be clobbered before
(...skipping 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5385 MemOperand(fp, 6 * kPointerSize), NULL); 5396 MemOperand(fp, 6 * kPointerSize), NULL);
5386 } 5397 }
5387 5398
5388 5399
5389 #undef __ 5400 #undef __
5390 5401
5391 } // namespace internal 5402 } // namespace internal
5392 } // namespace v8 5403 } // namespace v8
5393 5404
5394 #endif // V8_TARGET_ARCH_ARM 5405 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698