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

Side by Side Diff: src/mips/code-stubs-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 __ AssertNotSmi(function_prototype); 1499 __ AssertNotSmi(function_prototype);
1500 1500
1501 // Update the global instanceof cache with the current {object} map and 1501 // Update the global instanceof cache with the current {object} map and
1502 // {function}. The cached answer will be set when it is known below. 1502 // {function}. The cached answer will be set when it is known below.
1503 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); 1503 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex);
1504 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); 1504 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex);
1505 1505
1506 // Loop through the prototype chain looking for the {function} prototype. 1506 // Loop through the prototype chain looking for the {function} prototype.
1507 // Assume true, and change to false if not found. 1507 // Assume true, and change to false if not found.
1508 Register const object_instance_type = function_map; 1508 Register const object_instance_type = function_map;
1509 Register const map_bit_field = function_map;
1509 Register const null = scratch; 1510 Register const null = scratch;
1510 Register const result = v0; 1511 Register const result = v0;
1511 Label done, loop, proxy_case; 1512
1513 Label done, loop, fast_runtime_fallback;
1512 __ LoadRoot(result, Heap::kTrueValueRootIndex); 1514 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1513 __ LoadRoot(null, Heap::kNullValueRootIndex); 1515 __ LoadRoot(null, Heap::kNullValueRootIndex);
1514 __ bind(&loop); 1516 __ bind(&loop);
1517
1518 // Check if the object needs to be access checked.
1519 __ lbu(map_bit_field, FieldMemOperand(object_map, Map::kBitFieldOffset));
1520 __ And(map_bit_field, map_bit_field, Operand(1 << Map::kIsAccessCheckNeeded));
1521 __ Branch(&fast_runtime_fallback, ne, map_bit_field, Operand(zero_reg));
1522 // Check if the current object is a Proxy.
1515 __ lbu(object_instance_type, 1523 __ lbu(object_instance_type,
1516 FieldMemOperand(object_map, Map::kInstanceTypeOffset)); 1524 FieldMemOperand(object_map, Map::kInstanceTypeOffset));
1517 __ Branch(&proxy_case, eq, object_instance_type, Operand(JS_PROXY_TYPE)); 1525 __ Branch(&fast_runtime_fallback, eq, object_instance_type,
1526 Operand(JS_PROXY_TYPE));
1527
1518 __ lw(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); 1528 __ lw(object, FieldMemOperand(object_map, Map::kPrototypeOffset));
1519 __ Branch(&done, eq, object, Operand(function_prototype)); 1529 __ Branch(&done, eq, object, Operand(function_prototype));
1520 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null)); 1530 __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null));
1521 __ lw(object_map, 1531 __ lw(object_map,
1522 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot. 1532 FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot.
1523 __ LoadRoot(result, Heap::kFalseValueRootIndex); 1533 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1524 __ bind(&done); 1534 __ bind(&done);
1525 __ Ret(USE_DELAY_SLOT); 1535 __ Ret(USE_DELAY_SLOT);
1526 __ StoreRoot(result, 1536 __ StoreRoot(result,
1527 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot. 1537 Heap::kInstanceofCacheAnswerRootIndex); // In delay slot.
1528 1538
1529 // Proxy-case: Call the %HasInPrototypeChain runtime function. 1539 // Found Proxy or access check needed: Call the runtime
1530 __ bind(&proxy_case); 1540 __ bind(&fast_runtime_fallback);
1531 __ Push(object, function_prototype); 1541 __ Push(object, function_prototype);
1532 // Invalidate the instanceof cache. 1542 // Invalidate the instanceof cache.
1533 DCHECK(Smi::FromInt(0) == 0); 1543 DCHECK(Smi::FromInt(0) == 0);
1534 __ StoreRoot(zero_reg, Heap::kInstanceofCacheFunctionRootIndex); 1544 __ StoreRoot(zero_reg, Heap::kInstanceofCacheFunctionRootIndex);
1535 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1); 1545 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
1536 1546
1537 // Slow-case: Call the %InstanceOf runtime function. 1547 // Slow-case: Call the %InstanceOf runtime function.
1538 __ bind(&slow_case); 1548 __ bind(&slow_case);
1539 __ Push(object, function); 1549 __ Push(object, function);
1540 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); 1550 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
(...skipping 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after
5568 MemOperand(fp, 6 * kPointerSize), NULL); 5578 MemOperand(fp, 6 * kPointerSize), NULL);
5569 } 5579 }
5570 5580
5571 5581
5572 #undef __ 5582 #undef __
5573 5583
5574 } // namespace internal 5584 } // namespace internal
5575 } // namespace v8 5585 } // namespace v8
5576 5586
5577 #endif // V8_TARGET_ARCH_MIPS 5587 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | src/prototype.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698