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

Side by Side Diff: src/mips64/macro-assembler-mips64.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/mips64/macro-assembler-mips64.h ('k') | src/profiler/heap-snapshot-generator.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 #include <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/base/division-by-constant.h" 9 #include "src/base/division-by-constant.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 // Load current lexical context from the stack frame. 431 // Load current lexical context from the stack frame.
432 ld(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); 432 ld(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset));
433 // In debug mode, make sure the lexical context is set. 433 // In debug mode, make sure the lexical context is set.
434 #ifdef DEBUG 434 #ifdef DEBUG
435 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, 435 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext,
436 scratch, Operand(zero_reg)); 436 scratch, Operand(zero_reg));
437 #endif 437 #endif
438 438
439 // Load the native context of the current context. 439 // Load the native context of the current context.
440 ld(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); 440 int offset =
441 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
442 ld(scratch, FieldMemOperand(scratch, offset));
443 ld(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset));
441 444
442 // Check the context is a native context. 445 // Check the context is a native context.
443 if (emit_debug_code()) { 446 if (emit_debug_code()) {
444 push(holder_reg); // Temporarily save holder on the stack. 447 push(holder_reg); // Temporarily save holder on the stack.
445 // Read the first word and compare to the native_context_map. 448 // Read the first word and compare to the native_context_map.
446 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); 449 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
447 LoadRoot(at, Heap::kNativeContextMapRootIndex); 450 LoadRoot(at, Heap::kNativeContextMapRootIndex);
448 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, 451 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext,
449 holder_reg, Operand(at)); 452 holder_reg, Operand(at));
450 pop(holder_reg); // Restore holder. 453 pop(holder_reg); // Restore holder.
(...skipping 4393 matching lines...) Expand 10 before | Expand all | Expand 10 after
4844 Operand(zero_reg), 4847 Operand(zero_reg),
4845 bd); 4848 bd);
4846 } 4849 }
4847 4850
4848 4851
4849 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, 4852 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
4850 const CallWrapper& call_wrapper) { 4853 const CallWrapper& call_wrapper) {
4851 // You can't call a builtin without a valid frame. 4854 // You can't call a builtin without a valid frame.
4852 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4855 DCHECK(flag == JUMP_FUNCTION || has_frame());
4853 4856
4854 LoadNativeContextSlot(native_context_index, a1); 4857 GetBuiltinEntry(t9, native_context_index);
4855 ld(t9, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4856 if (flag == CALL_FUNCTION) { 4858 if (flag == CALL_FUNCTION) {
4857 call_wrapper.BeforeCall(CallSize(t9)); 4859 call_wrapper.BeforeCall(CallSize(t9));
4858 Call(t9); 4860 Call(t9);
4859 call_wrapper.AfterCall(); 4861 call_wrapper.AfterCall();
4860 } else { 4862 } else {
4861 DCHECK(flag == JUMP_FUNCTION); 4863 DCHECK(flag == JUMP_FUNCTION);
4862 Jump(t9); 4864 Jump(t9);
4863 } 4865 }
4864 } 4866 }
4865 4867
4866 4868
4869 void MacroAssembler::GetBuiltinFunction(Register target,
4870 int native_context_index) {
4871 // Load the builtins object into target register.
4872 ld(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
4873 ld(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset));
4874 // Load the JavaScript builtin function from the builtins object.
4875 ld(target, ContextOperand(target, native_context_index));
4876 }
4877
4878
4879 void MacroAssembler::GetBuiltinEntry(Register target,
4880 int native_context_index) {
4881 DCHECK(!target.is(a1));
4882 GetBuiltinFunction(a1, native_context_index);
4883 // Load the code entry point from the builtins object.
4884 ld(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4885 }
4886
4887
4867 void MacroAssembler::SetCounter(StatsCounter* counter, int value, 4888 void MacroAssembler::SetCounter(StatsCounter* counter, int value,
4868 Register scratch1, Register scratch2) { 4889 Register scratch1, Register scratch2) {
4869 if (FLAG_native_code_counters && counter->Enabled()) { 4890 if (FLAG_native_code_counters && counter->Enabled()) {
4870 li(scratch1, Operand(value)); 4891 li(scratch1, Operand(value));
4871 li(scratch2, Operand(ExternalReference(counter))); 4892 li(scratch2, Operand(ExternalReference(counter)));
4872 sd(scratch1, MemOperand(scratch2)); 4893 sd(scratch1, MemOperand(scratch2));
4873 } 4894 }
4874 } 4895 }
4875 4896
4876 4897
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4990 } 5011 }
4991 } else { 5012 } else {
4992 // Slot is in the current function context. Move it into the 5013 // Slot is in the current function context. Move it into the
4993 // destination register in case we store into it (the write barrier 5014 // destination register in case we store into it (the write barrier
4994 // cannot be allowed to destroy the context in esi). 5015 // cannot be allowed to destroy the context in esi).
4995 Move(dst, cp); 5016 Move(dst, cp);
4996 } 5017 }
4997 } 5018 }
4998 5019
4999 5020
5021 void MacroAssembler::LoadGlobalProxy(Register dst) {
5022 ld(dst, GlobalObjectOperand());
5023 ld(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset));
5024 }
5025
5026
5000 void MacroAssembler::LoadTransitionedArrayMapConditional( 5027 void MacroAssembler::LoadTransitionedArrayMapConditional(
5001 ElementsKind expected_kind, 5028 ElementsKind expected_kind,
5002 ElementsKind transitioned_kind, 5029 ElementsKind transitioned_kind,
5003 Register map_in_out, 5030 Register map_in_out,
5004 Register scratch, 5031 Register scratch,
5005 Label* no_map_match) { 5032 Label* no_map_match) {
5033 // Load the global or builtins object from the current context.
5034 ld(scratch,
5035 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
5036 ld(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset));
5037
5006 // Check that the function's map is the same as the expected cached map. 5038 // Check that the function's map is the same as the expected cached map.
5007 LoadNativeContextSlot(Context::JS_ARRAY_MAPS_INDEX, scratch); 5039 ld(scratch,
5040 MemOperand(scratch,
5041 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
5008 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; 5042 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize;
5009 ld(at, FieldMemOperand(scratch, offset)); 5043 ld(at, FieldMemOperand(scratch, offset));
5010 Branch(no_map_match, ne, map_in_out, Operand(at)); 5044 Branch(no_map_match, ne, map_in_out, Operand(at));
5011 5045
5012 // Use the transitioned cached map. 5046 // Use the transitioned cached map.
5013 offset = transitioned_kind * kPointerSize + 5047 offset = transitioned_kind * kPointerSize +
5014 FixedArrayBase::kHeaderSize; 5048 FixedArrayBase::kHeaderSize;
5015 ld(map_in_out, FieldMemOperand(scratch, offset)); 5049 ld(map_in_out, FieldMemOperand(scratch, offset));
5016 } 5050 }
5017 5051
5018 5052
5019 void MacroAssembler::LoadNativeContextSlot(int index, Register dst) { 5053 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
5020 ld(dst, NativeContextMemOperand()); 5054 // Load the global or builtins object from the current context.
5021 ld(dst, ContextMemOperand(dst, index)); 5055 ld(function,
5056 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
5057 // Load the native context from the global or builtins object.
5058 ld(function, FieldMemOperand(function, JSGlobalObject::kNativeContextOffset));
5059 // Load the function from the native context.
5060 ld(function, MemOperand(function, Context::SlotOffset(index)));
5022 } 5061 }
5023 5062
5024 5063
5025 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 5064 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
5026 Register map, 5065 Register map,
5027 Register scratch) { 5066 Register scratch) {
5028 // Load the initial map. The global functions all have initial maps. 5067 // Load the initial map. The global functions all have initial maps.
5029 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 5068 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
5030 if (emit_debug_code()) { 5069 if (emit_debug_code()) {
5031 Label ok, fail; 5070 Label ok, fail;
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6245 if (mag.shift > 0) sra(result, result, mag.shift); 6284 if (mag.shift > 0) sra(result, result, mag.shift);
6246 srl(at, dividend, 31); 6285 srl(at, dividend, 31);
6247 Addu(result, result, Operand(at)); 6286 Addu(result, result, Operand(at));
6248 } 6287 }
6249 6288
6250 6289
6251 } // namespace internal 6290 } // namespace internal
6252 } // namespace v8 6291 } // namespace v8
6253 6292
6254 #endif // V8_TARGET_ARCH_MIPS64 6293 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/profiler/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698