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

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

Issue 1155673005: Fix issues with Arm's use of embedded constant pools (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 // the context will be set to (cp == 0) for non-JS frames. 1093 // the context will be set to (cp == 0) for non-JS frames.
1094 __ cmp(cp, Operand(0)); 1094 __ cmp(cp, Operand(0));
1095 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); 1095 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
1096 1096
1097 // Compute the handler entry address and jump to it. 1097 // Compute the handler entry address and jump to it.
1098 ConstantPoolUnavailableScope constant_pool_unavailable(masm); 1098 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
1099 __ mov(r1, Operand(pending_handler_code_address)); 1099 __ mov(r1, Operand(pending_handler_code_address));
1100 __ ldr(r1, MemOperand(r1)); 1100 __ ldr(r1, MemOperand(r1));
1101 __ mov(r2, Operand(pending_handler_offset_address)); 1101 __ mov(r2, Operand(pending_handler_offset_address));
1102 __ ldr(r2, MemOperand(r2)); 1102 __ ldr(r2, MemOperand(r2));
1103 __ add(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start
1103 if (FLAG_enable_embedded_constant_pool) { 1104 if (FLAG_enable_embedded_constant_pool) {
1104 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r1); 1105 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r1);
1105 } 1106 }
1106 __ add(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag));
1107 __ add(pc, r1, r2); 1107 __ add(pc, r1, r2);
1108 } 1108 }
1109 1109
1110 1110
1111 void JSEntryStub::Generate(MacroAssembler* masm) { 1111 void JSEntryStub::Generate(MacroAssembler* masm) {
1112 // r0: code entry 1112 // r0: code entry
1113 // r1: function 1113 // r1: function
1114 // r2: receiver 1114 // r2: receiver
1115 // r3: argc 1115 // r3: argc
1116 // [sp+0]: argv 1116 // [sp+0]: argv
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1340
1341 // The map_load_offset was stored in r5 1341 // The map_load_offset was stored in r5
1342 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal). 1342 // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal).
1343 const Register map_load_offset = r5; 1343 const Register map_load_offset = r5;
1344 __ sub(r9, lr, map_load_offset); 1344 __ sub(r9, lr, map_load_offset);
1345 // Get the map location in r5 and patch it. 1345 // Get the map location in r5 and patch it.
1346 __ GetRelocatedValueLocation(r9, map_load_offset, scratch); 1346 __ GetRelocatedValueLocation(r9, map_load_offset, scratch);
1347 __ ldr(map_load_offset, MemOperand(map_load_offset)); 1347 __ ldr(map_load_offset, MemOperand(map_load_offset));
1348 __ str(map, FieldMemOperand(map_load_offset, Cell::kValueOffset)); 1348 __ str(map, FieldMemOperand(map_load_offset, Cell::kValueOffset));
1349 1349
1350 __ mov(r8, map); 1350 Register value_scratch = (FLAG_enable_embedded_constant_pool ? r6 : r8);
1351 if (FLAG_enable_embedded_constant_pool) {
1352 __ push(value_scratch);
1353 }
1354
1355 __ mov(value_scratch, map);
1351 // |map_load_offset| points at the beginning of the cell. Calculate the 1356 // |map_load_offset| points at the beginning of the cell. Calculate the
1352 // field containing the map. 1357 // field containing the map.
1353 __ add(function, map_load_offset, Operand(Cell::kValueOffset - 1)); 1358 __ add(function, map_load_offset, Operand(Cell::kValueOffset - 1));
1354 __ RecordWriteField(map_load_offset, Cell::kValueOffset, r8, function, 1359 __ RecordWriteField(map_load_offset, Cell::kValueOffset, value_scratch,
rmcilroy 2015/06/08 11:11:10 Could we just use "scratch" here? It looks like it
MTBrandyberry 2015/06/08 13:52:39 Good catch. Done.
1355 kLRHasNotBeenSaved, kDontSaveFPRegs, 1360 function, kLRHasNotBeenSaved, kDontSaveFPRegs,
1356 OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 1361 OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
1362 if (FLAG_enable_embedded_constant_pool) {
1363 __ pop(value_scratch);
1364 }
1357 } 1365 }
1358 1366
1359 // Register mapping: r3 is object map and r4 is function prototype. 1367 // Register mapping: r3 is object map and r4 is function prototype.
1360 // Get prototype of object into r2. 1368 // Get prototype of object into r2.
1361 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset)); 1369 __ ldr(scratch, FieldMemOperand(map, Map::kPrototypeOffset));
1362 1370
1363 // We don't need map any more. Use it as a scratch register. 1371 // We don't need map any more. Use it as a scratch register.
1364 Register scratch2 = map; 1372 Register scratch2 = map;
1365 map = no_reg; 1373 map = no_reg;
1366 1374
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 // Load the cache state into r4. 2434 // Load the cache state into r4.
2427 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 2435 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
2428 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 2436 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
2429 2437
2430 // A monomorphic cache hit or an already megamorphic state: invoke the 2438 // A monomorphic cache hit or an already megamorphic state: invoke the
2431 // function without changing the state. 2439 // function without changing the state.
2432 // We don't know if r4 is a WeakCell or a Symbol, but it's harmless to read at 2440 // We don't know if r4 is a WeakCell or a Symbol, but it's harmless to read at
2433 // this position in a symbol (see static asserts in type-feedback-vector.h). 2441 // this position in a symbol (see static asserts in type-feedback-vector.h).
2434 Label check_allocation_site; 2442 Label check_allocation_site;
2435 Register feedback_map = r5; 2443 Register feedback_map = r5;
2436 Register weak_value = r8; 2444 Register weak_value = r6;
2437 __ ldr(weak_value, FieldMemOperand(r4, WeakCell::kValueOffset)); 2445 __ ldr(weak_value, FieldMemOperand(r4, WeakCell::kValueOffset));
2438 __ cmp(r1, weak_value); 2446 __ cmp(r1, weak_value);
2439 __ b(eq, &done); 2447 __ b(eq, &done);
2440 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); 2448 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex);
2441 __ b(eq, &done); 2449 __ b(eq, &done);
2442 __ ldr(feedback_map, FieldMemOperand(r4, HeapObject::kMapOffset)); 2450 __ ldr(feedback_map, FieldMemOperand(r4, HeapObject::kMapOffset));
2443 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); 2451 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex);
2444 __ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); 2452 __ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
2445 2453
2446 // If the weak cell is cleared, we have a new chance to become monomorphic. 2454 // If the weak cell is cleared, we have a new chance to become monomorphic.
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
4487 } 4495 }
4488 4496
4489 4497
4490 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { 4498 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
4491 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r1 4499 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r1
4492 Register name = LoadWithVectorDescriptor::NameRegister(); // r2 4500 Register name = LoadWithVectorDescriptor::NameRegister(); // r2
4493 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r3 4501 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r3
4494 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r0 4502 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r0
4495 Register feedback = r4; 4503 Register feedback = r4;
4496 Register receiver_map = r5; 4504 Register receiver_map = r5;
4497 Register scratch1 = r8; 4505 Register scratch1 = r6;
4498 4506
4499 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); 4507 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot));
4500 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); 4508 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize));
4501 4509
4502 // Try to quickly handle the monomorphic case without knowing for sure 4510 // Try to quickly handle the monomorphic case without knowing for sure
4503 // if we have a weak cell in feedback. We do know it's safe to look 4511 // if we have a weak cell in feedback. We do know it's safe to look
4504 // at WeakCell::kValueOffset. 4512 // at WeakCell::kValueOffset.
4505 Label try_array, load_smi_map, compare_map; 4513 Label try_array, load_smi_map, compare_map;
4506 Label not_array, miss; 4514 Label not_array, miss;
4507 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, 4515 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 } 4552 }
4545 4553
4546 4554
4547 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { 4555 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
4548 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r1 4556 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r1
4549 Register key = LoadWithVectorDescriptor::NameRegister(); // r2 4557 Register key = LoadWithVectorDescriptor::NameRegister(); // r2
4550 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r3 4558 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r3
4551 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r0 4559 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r0
4552 Register feedback = r4; 4560 Register feedback = r4;
4553 Register receiver_map = r5; 4561 Register receiver_map = r5;
4554 Register scratch1 = r8; 4562 Register scratch1 = r6;
4555 4563
4556 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); 4564 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot));
4557 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); 4565 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize));
4558 4566
4559 // Try to quickly handle the monomorphic case without knowing for sure 4567 // Try to quickly handle the monomorphic case without knowing for sure
4560 // if we have a weak cell in feedback. We do know it's safe to look 4568 // if we have a weak cell in feedback. We do know it's safe to look
4561 // at WeakCell::kValueOffset. 4569 // at WeakCell::kValueOffset.
4562 Label try_array, load_smi_map, compare_map; 4570 Label try_array, load_smi_map, compare_map;
4563 Label not_array, miss; 4571 Label not_array, miss;
4564 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, 4572 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot,
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
5359 MemOperand(fp, 6 * kPointerSize), NULL); 5367 MemOperand(fp, 6 * kPointerSize), NULL);
5360 } 5368 }
5361 5369
5362 5370
5363 #undef __ 5371 #undef __
5364 5372
5365 } // namespace internal 5373 } // namespace internal
5366 } // namespace v8 5374 } // namespace v8
5367 5375
5368 #endif // V8_TARGET_ARCH_ARM 5376 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698