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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 2455953002: [ic] Remove unnecessary access rights checks from the IC handlers. (Closed)
Patch Set: Addressing comments and rebasing Created 4 years, 1 month 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/ia32/macro-assembler-ia32.h ('k') | src/ic/arm/handler-compiler-arm.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/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 1275
1276 1276
1277 void MacroAssembler::PopStackHandler() { 1277 void MacroAssembler::PopStackHandler() {
1278 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); 1278 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
1279 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); 1279 ExternalReference handler_address(Isolate::kHandlerAddress, isolate());
1280 pop(Operand::StaticVariable(handler_address)); 1280 pop(Operand::StaticVariable(handler_address));
1281 add(esp, Immediate(StackHandlerConstants::kSize - kPointerSize)); 1281 add(esp, Immediate(StackHandlerConstants::kSize - kPointerSize));
1282 } 1282 }
1283 1283
1284 1284
1285 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
1286 Register scratch1,
1287 Register scratch2,
1288 Label* miss) {
1289 Label same_contexts;
1290
1291 DCHECK(!holder_reg.is(scratch1));
1292 DCHECK(!holder_reg.is(scratch2));
1293 DCHECK(!scratch1.is(scratch2));
1294
1295 // Load current lexical context from the active StandardFrame, which
1296 // may require crawling past STUB frames.
1297 Label load_context;
1298 Label has_context;
1299 mov(scratch2, ebp);
1300 bind(&load_context);
1301 mov(scratch1,
1302 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset));
1303 JumpIfNotSmi(scratch1, &has_context);
1304 mov(scratch2, MemOperand(scratch2, CommonFrameConstants::kCallerFPOffset));
1305 jmp(&load_context);
1306 bind(&has_context);
1307
1308 // When generating debug code, make sure the lexical context is set.
1309 if (emit_debug_code()) {
1310 cmp(scratch1, Immediate(0));
1311 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext);
1312 }
1313 // Load the native context of the current context.
1314 mov(scratch1, ContextOperand(scratch1, Context::NATIVE_CONTEXT_INDEX));
1315
1316 // Check the context is a native context.
1317 if (emit_debug_code()) {
1318 // Read the first word and compare to native_context_map.
1319 cmp(FieldOperand(scratch1, HeapObject::kMapOffset),
1320 isolate()->factory()->native_context_map());
1321 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext);
1322 }
1323
1324 // Check if both contexts are the same.
1325 cmp(scratch1, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1326 j(equal, &same_contexts);
1327
1328 // Compare security tokens, save holder_reg on the stack so we can use it
1329 // as a temporary register.
1330 //
1331 // Check that the security token in the calling global object is
1332 // compatible with the security token in the receiving global
1333 // object.
1334 mov(scratch2,
1335 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1336
1337 // Check the context is a native context.
1338 if (emit_debug_code()) {
1339 cmp(scratch2, isolate()->factory()->null_value());
1340 Check(not_equal, kJSGlobalProxyContextShouldNotBeNull);
1341
1342 // Read the first word and compare to native_context_map(),
1343 cmp(FieldOperand(scratch2, HeapObject::kMapOffset),
1344 isolate()->factory()->native_context_map());
1345 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext);
1346 }
1347
1348 int token_offset = Context::kHeaderSize +
1349 Context::SECURITY_TOKEN_INDEX * kPointerSize;
1350 mov(scratch1, FieldOperand(scratch1, token_offset));
1351 cmp(scratch1, FieldOperand(scratch2, token_offset));
1352 j(not_equal, miss);
1353
1354 bind(&same_contexts);
1355 }
1356
1357
1358 // Compute the hash code from the untagged key. This must be kept in sync with 1285 // Compute the hash code from the untagged key. This must be kept in sync with
1359 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in 1286 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in
1360 // code-stub-hydrogen.cc 1287 // code-stub-hydrogen.cc
1361 // 1288 //
1362 // Note: r0 will contain hash code 1289 // Note: r0 will contain hash code
1363 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { 1290 void MacroAssembler::GetNumberHash(Register r0, Register scratch) {
1364 // Xor original key with a seed. 1291 // Xor original key with a seed.
1365 if (serializer_enabled()) { 1292 if (serializer_enabled()) {
1366 ExternalReference roots_array_start = 1293 ExternalReference roots_array_start =
1367 ExternalReference::roots_array_start(isolate()); 1294 ExternalReference::roots_array_start(isolate());
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 mov(eax, dividend); 3212 mov(eax, dividend);
3286 shr(eax, 31); 3213 shr(eax, 31);
3287 add(edx, eax); 3214 add(edx, eax);
3288 } 3215 }
3289 3216
3290 3217
3291 } // namespace internal 3218 } // namespace internal
3292 } // namespace v8 3219 } // namespace v8
3293 3220
3294 #endif // V8_TARGET_ARCH_IA32 3221 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ic/arm/handler-compiler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698