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

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

Issue 1521953002: [proxies] fix access issue when having proxies on the prototype-chain of global objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ppc code mess 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
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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 __ AssertNotSmi(function_prototype); 1501 __ AssertNotSmi(function_prototype);
1502 1502
1503 // Update the global instanceof cache with the current {object} map and 1503 // Update the global instanceof cache with the current {object} map and
1504 // {function}. The cached answer will be set when it is known below. 1504 // {function}. The cached answer will be set when it is known below.
1505 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); 1505 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
1506 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); 1506 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
1507 1507
1508 // Loop through the prototype chain looking for the {function} prototype. 1508 // Loop through the prototype chain looking for the {function} prototype.
1509 // Assume true, and change to false if not found. 1509 // Assume true, and change to false if not found.
1510 Register const object_instance_type = function_map; 1510 Register const object_instance_type = function_map;
1511 Register const map_bit_field = function_map;
1511 Register const null = scratch; 1512 Register const null = scratch;
1512 Register const result = v0; 1513 Register const result = v0;
1513 Label done, loop, proxy_case; 1514
1515 Label done, loop, fast_runtime_fallback;
1514 __ LoadRoot(result, Heap::kTrueValueRootIndex); 1516 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1515 __ LoadRoot(null, Heap::kNullValueRootIndex); 1517 __ LoadRoot(null, Heap::kNullValueRootIndex);
1516 __ bind(&loop); 1518 __ bind(&loop);
1519
1520 // Check if the object needs to be access checked.
1521 __ lbu(map_bit_field, FieldMemOperand(object_map, Map::kBitFieldOffset));
1522 __ And(map_bit_field, map_bit_field, Operand(1 << Map::kIsAccessCheckNeeded));
1523 __ Branch(&fast_runtime_fallback, ne, map_bit_field, Operand(zero_reg));
1524 // Check if the current object is a Proxy.
1517 __ lbu(object_instance_type, 1525 __ lbu(object_instance_type,
1518 FieldMemOperand(object_map, Map::kInstanceTypeOffset)); 1526 FieldMemOperand(object_map, Map::kInstanceTypeOffset));
1519 __ Branch(&proxy_case, eq, object_instance_type, Operand(JS_PROXY_TYPE)); 1527 __ Branch(&fast_runtime_fallback, eq, object_instance_type,
1528 Operand(JS_PROXY_TYPE));
1529
1520 __ ld(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); 1530 __ ld(object, FieldMemOperand(object_map, Map::kPrototypeOffset));
1521 __ Branch(&done, eq, object, Operand(function_prototype)); 1531 __ Branch(&done, eq, object, Operand(function_prototype));
1522 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null)); 1532 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null));
1523 __ ld(object_map, 1533 __ ld(object_map,
1524 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot. 1534 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot.
1525 __ LoadRoot(result, Heap::kFalseValueRootIndex); 1535 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1526 __ bind(&done); 1536 __ bind(&done);
1527 __ Ret(USE_DELAY_SLOT); 1537 __ Ret(USE_DELAY_SLOT);
1528 __ StoreRoot(result, 1538 __ StoreRoot(result,
1529 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. 1539 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot.
1530 1540
1531 // Proxy-case: Call the %HasInPrototypeChain runtime function. 1541 // Found Proxy or access check needed: Call the runtime
1532 __ bind(&proxy_case); 1542 __ bind(&fast_runtime_fallback);
1533 __ Push(object, function_prototype); 1543 __ Push(object, function_prototype);
1534 // Invalidate the instanceof cache. 1544 // Invalidate the instanceof cache.
1535 DCHECK(Smi::FromInt(0) == 0); 1545 DCHECK(Smi::FromInt(0) == 0);
1536 __ StoreRoot(zero_reg, Heap::kInstanceofCacheFunctionRootIndex); 1546 __ StoreRoot(zero_reg, Heap::kInstanceofCacheFunctionRootIndex);
1537 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1); 1547 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
1538 1548
1539 // Slow-case: Call the %InstanceOf runtime function. 1549 // Slow-case: Call the %InstanceOf runtime function.
1540 __ bind(&slow_case); 1550 __ bind(&slow_case);
1541 __ Push(object, function); 1551 __ Push(object, function);
1542 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 1552 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
(...skipping 4055 matching lines...) Expand 10 before | Expand all | Expand 10 after
5598 MemOperand(fp, 6 * kPointerSize), NULL); 5608 MemOperand(fp, 6 * kPointerSize), NULL);
5599 } 5609 }
5600 5610
5601 5611
5602 #undef __ 5612 #undef __
5603 5613
5604 } // namespace internal 5614 } // namespace internal
5605 } // namespace v8 5615 } // namespace v8
5606 5616
5607 #endif // V8_TARGET_ARCH_MIPS64 5617 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/objects-inl.h » ('j') | src/prototype.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698