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

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

Issue 1478303002: Revert of [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/mips/macro-assembler-mips.h ('k') | src/mips64/builtins-mips64.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 1
2 // Copyright 2012 the V8 project authors. All rights reserved. 2 // Copyright 2012 the V8 project authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_MIPS 8 #if V8_TARGET_ARCH_MIPS
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 // Load current lexical context from the stack frame. 428 // Load current lexical context from the stack frame.
429 lw(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); 429 lw(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset));
430 // In debug mode, make sure the lexical context is set. 430 // In debug mode, make sure the lexical context is set.
431 #ifdef DEBUG 431 #ifdef DEBUG
432 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, 432 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext,
433 scratch, Operand(zero_reg)); 433 scratch, Operand(zero_reg));
434 #endif 434 #endif
435 435
436 // Load the native context of the current context. 436 // Load the native context of the current context.
437 lw(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); 437 int offset =
438 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
439 lw(scratch, FieldMemOperand(scratch, offset));
440 lw(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset));
438 441
439 // Check the context is a native context. 442 // Check the context is a native context.
440 if (emit_debug_code()) { 443 if (emit_debug_code()) {
441 push(holder_reg); // Temporarily save holder on the stack. 444 push(holder_reg); // Temporarily save holder on the stack.
442 // Read the first word and compare to the native_context_map. 445 // Read the first word and compare to the native_context_map.
443 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); 446 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
444 LoadRoot(at, Heap::kNativeContextMapRootIndex); 447 LoadRoot(at, Heap::kNativeContextMapRootIndex);
445 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, 448 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext,
446 holder_reg, Operand(at)); 449 holder_reg, Operand(at));
447 pop(holder_reg); // Restore holder. 450 pop(holder_reg); // Restore holder.
(...skipping 4058 matching lines...) Expand 10 before | Expand all | Expand 10 after
4506 Operand(zero_reg), 4509 Operand(zero_reg),
4507 bd); 4510 bd);
4508 } 4511 }
4509 4512
4510 4513
4511 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, 4514 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
4512 const CallWrapper& call_wrapper) { 4515 const CallWrapper& call_wrapper) {
4513 // You can't call a builtin without a valid frame. 4516 // You can't call a builtin without a valid frame.
4514 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4517 DCHECK(flag == JUMP_FUNCTION || has_frame());
4515 4518
4516 LoadNativeContextSlot(native_context_index, a1); 4519 GetBuiltinEntry(t9, native_context_index);
4517 lw(t9, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4518 if (flag == CALL_FUNCTION) { 4520 if (flag == CALL_FUNCTION) {
4519 call_wrapper.BeforeCall(CallSize(t9)); 4521 call_wrapper.BeforeCall(CallSize(t9));
4520 Call(t9); 4522 Call(t9);
4521 call_wrapper.AfterCall(); 4523 call_wrapper.AfterCall();
4522 } else { 4524 } else {
4523 DCHECK(flag == JUMP_FUNCTION); 4525 DCHECK(flag == JUMP_FUNCTION);
4524 Jump(t9); 4526 Jump(t9);
4525 } 4527 }
4526 } 4528 }
4527 4529
4528 4530
4531 void MacroAssembler::GetBuiltinFunction(Register target,
4532 int native_context_index) {
4533 // Load the builtins object into target register.
4534 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
4535 lw(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset));
4536 // Load the JavaScript builtin function from the builtins object.
4537 lw(target, ContextOperand(target, native_context_index));
4538 }
4539
4540
4541 void MacroAssembler::GetBuiltinEntry(Register target,
4542 int native_context_index) {
4543 DCHECK(!target.is(a1));
4544 GetBuiltinFunction(a1, native_context_index);
4545 // Load the code entry point from the builtins object.
4546 lw(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4547 }
4548
4549
4529 void MacroAssembler::SetCounter(StatsCounter* counter, int value, 4550 void MacroAssembler::SetCounter(StatsCounter* counter, int value,
4530 Register scratch1, Register scratch2) { 4551 Register scratch1, Register scratch2) {
4531 if (FLAG_native_code_counters && counter->Enabled()) { 4552 if (FLAG_native_code_counters && counter->Enabled()) {
4532 li(scratch1, Operand(value)); 4553 li(scratch1, Operand(value));
4533 li(scratch2, Operand(ExternalReference(counter))); 4554 li(scratch2, Operand(ExternalReference(counter)));
4534 sw(scratch1, MemOperand(scratch2)); 4555 sw(scratch1, MemOperand(scratch2));
4535 } 4556 }
4536 } 4557 }
4537 4558
4538 4559
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4652 } 4673 }
4653 } else { 4674 } else {
4654 // Slot is in the current function context. Move it into the 4675 // Slot is in the current function context. Move it into the
4655 // destination register in case we store into it (the write barrier 4676 // destination register in case we store into it (the write barrier
4656 // cannot be allowed to destroy the context in esi). 4677 // cannot be allowed to destroy the context in esi).
4657 Move(dst, cp); 4678 Move(dst, cp);
4658 } 4679 }
4659 } 4680 }
4660 4681
4661 4682
4683 void MacroAssembler::LoadGlobalProxy(Register dst) {
4684 lw(dst, GlobalObjectOperand());
4685 lw(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset));
4686 }
4687
4688
4662 void MacroAssembler::LoadTransitionedArrayMapConditional( 4689 void MacroAssembler::LoadTransitionedArrayMapConditional(
4663 ElementsKind expected_kind, 4690 ElementsKind expected_kind,
4664 ElementsKind transitioned_kind, 4691 ElementsKind transitioned_kind,
4665 Register map_in_out, 4692 Register map_in_out,
4666 Register scratch, 4693 Register scratch,
4667 Label* no_map_match) { 4694 Label* no_map_match) {
4695 // Load the global or builtins object from the current context.
4696 lw(scratch,
4697 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
4698 lw(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset));
4699
4668 // Check that the function's map is the same as the expected cached map. 4700 // Check that the function's map is the same as the expected cached map.
4669 LoadNativeContextSlot(Context::JS_ARRAY_MAPS_INDEX, scratch); 4701 lw(scratch,
4702 MemOperand(scratch,
4703 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
4670 size_t offset = expected_kind * kPointerSize + 4704 size_t offset = expected_kind * kPointerSize +
4671 FixedArrayBase::kHeaderSize; 4705 FixedArrayBase::kHeaderSize;
4672 lw(at, FieldMemOperand(scratch, offset)); 4706 lw(at, FieldMemOperand(scratch, offset));
4673 Branch(no_map_match, ne, map_in_out, Operand(at)); 4707 Branch(no_map_match, ne, map_in_out, Operand(at));
4674 4708
4675 // Use the transitioned cached map. 4709 // Use the transitioned cached map.
4676 offset = transitioned_kind * kPointerSize + 4710 offset = transitioned_kind * kPointerSize +
4677 FixedArrayBase::kHeaderSize; 4711 FixedArrayBase::kHeaderSize;
4678 lw(map_in_out, FieldMemOperand(scratch, offset)); 4712 lw(map_in_out, FieldMemOperand(scratch, offset));
4679 } 4713 }
4680 4714
4681 4715
4682 void MacroAssembler::LoadNativeContextSlot(int index, Register dst) { 4716 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
4683 lw(dst, NativeContextMemOperand()); 4717 // Load the global or builtins object from the current context.
4684 lw(dst, ContextMemOperand(dst, index)); 4718 lw(function,
4719 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
4720 // Load the native context from the global or builtins object.
4721 lw(function, FieldMemOperand(function, JSGlobalObject::kNativeContextOffset));
4722 // Load the function from the native context.
4723 lw(function, MemOperand(function, Context::SlotOffset(index)));
4685 } 4724 }
4686 4725
4687 4726
4688 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 4727 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
4689 Register map, 4728 Register map,
4690 Register scratch) { 4729 Register scratch) {
4691 // Load the initial map. The global functions all have initial maps. 4730 // Load the initial map. The global functions all have initial maps.
4692 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 4731 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
4693 if (emit_debug_code()) { 4732 if (emit_debug_code()) {
4694 Label ok, fail; 4733 Label ok, fail;
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
5825 if (mag.shift > 0) sra(result, result, mag.shift); 5864 if (mag.shift > 0) sra(result, result, mag.shift);
5826 srl(at, dividend, 31); 5865 srl(at, dividend, 31);
5827 Addu(result, result, Operand(at)); 5866 Addu(result, result, Operand(at));
5828 } 5867 }
5829 5868
5830 5869
5831 } // namespace internal 5870 } // namespace internal
5832 } // namespace v8 5871 } // namespace v8
5833 5872
5834 #endif // V8_TARGET_ARCH_MIPS 5873 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698