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

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

Issue 1480003002: [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: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. 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 int offset = 440 ld(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX));
441 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
442 ld(scratch, FieldMemOperand(scratch, offset));
443 ld(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset));
444 441
445 // Check the context is a native context. 442 // Check the context is a native context.
446 if (emit_debug_code()) { 443 if (emit_debug_code()) {
447 push(holder_reg); // Temporarily save holder on the stack. 444 push(holder_reg); // Temporarily save holder on the stack.
448 // Read the first word and compare to the native_context_map. 445 // Read the first word and compare to the native_context_map.
449 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); 446 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
450 LoadRoot(at, Heap::kNativeContextMapRootIndex); 447 LoadRoot(at, Heap::kNativeContextMapRootIndex);
451 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, 448 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext,
452 holder_reg, Operand(at)); 449 holder_reg, Operand(at));
453 pop(holder_reg); // Restore holder. 450 pop(holder_reg); // Restore holder.
(...skipping 4393 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 Operand(zero_reg), 4844 Operand(zero_reg),
4848 bd); 4845 bd);
4849 } 4846 }
4850 4847
4851 4848
4852 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, 4849 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
4853 const CallWrapper& call_wrapper) { 4850 const CallWrapper& call_wrapper) {
4854 // You can't call a builtin without a valid frame. 4851 // You can't call a builtin without a valid frame.
4855 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4852 DCHECK(flag == JUMP_FUNCTION || has_frame());
4856 4853
4857 GetBuiltinEntry(t9, native_context_index); 4854 LoadNativeContextSlot(native_context_index, a1);
4855 ld(t9, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4858 if (flag == CALL_FUNCTION) { 4856 if (flag == CALL_FUNCTION) {
4859 call_wrapper.BeforeCall(CallSize(t9)); 4857 call_wrapper.BeforeCall(CallSize(t9));
4860 Call(t9); 4858 Call(t9);
4861 call_wrapper.AfterCall(); 4859 call_wrapper.AfterCall();
4862 } else { 4860 } else {
4863 DCHECK(flag == JUMP_FUNCTION); 4861 DCHECK(flag == JUMP_FUNCTION);
4864 Jump(t9); 4862 Jump(t9);
4865 } 4863 }
4866 } 4864 }
4867 4865
4868 4866
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
4888 void MacroAssembler::SetCounter(StatsCounter* counter, int value, 4867 void MacroAssembler::SetCounter(StatsCounter* counter, int value,
4889 Register scratch1, Register scratch2) { 4868 Register scratch1, Register scratch2) {
4890 if (FLAG_native_code_counters && counter->Enabled()) { 4869 if (FLAG_native_code_counters && counter->Enabled()) {
4891 li(scratch1, Operand(value)); 4870 li(scratch1, Operand(value));
4892 li(scratch2, Operand(ExternalReference(counter))); 4871 li(scratch2, Operand(ExternalReference(counter)));
4893 sd(scratch1, MemOperand(scratch2)); 4872 sd(scratch1, MemOperand(scratch2));
4894 } 4873 }
4895 } 4874 }
4896 4875
4897 4876
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5011 } 4990 }
5012 } else { 4991 } else {
5013 // Slot is in the current function context. Move it into the 4992 // Slot is in the current function context. Move it into the
5014 // destination register in case we store into it (the write barrier 4993 // destination register in case we store into it (the write barrier
5015 // cannot be allowed to destroy the context in esi). 4994 // cannot be allowed to destroy the context in esi).
5016 Move(dst, cp); 4995 Move(dst, cp);
5017 } 4996 }
5018 } 4997 }
5019 4998
5020 4999
5021 void MacroAssembler::LoadGlobalProxy(Register dst) {
5022 ld(dst, GlobalObjectOperand());
5023 ld(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset));
5024 }
5025
5026
5027 void MacroAssembler::LoadTransitionedArrayMapConditional( 5000 void MacroAssembler::LoadTransitionedArrayMapConditional(
5028 ElementsKind expected_kind, 5001 ElementsKind expected_kind,
5029 ElementsKind transitioned_kind, 5002 ElementsKind transitioned_kind,
5030 Register map_in_out, 5003 Register map_in_out,
5031 Register scratch, 5004 Register scratch,
5032 Label* no_map_match) { 5005 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
5038 // Check that the function's map is the same as the expected cached map. 5006 // Check that the function's map is the same as the expected cached map.
5039 ld(scratch, 5007 LoadNativeContextSlot(Context::JS_ARRAY_MAPS_INDEX, scratch);
5040 MemOperand(scratch,
5041 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
5042 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; 5008 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize;
5043 ld(at, FieldMemOperand(scratch, offset)); 5009 ld(at, FieldMemOperand(scratch, offset));
5044 Branch(no_map_match, ne, map_in_out, Operand(at)); 5010 Branch(no_map_match, ne, map_in_out, Operand(at));
5045 5011
5046 // Use the transitioned cached map. 5012 // Use the transitioned cached map.
5047 offset = transitioned_kind * kPointerSize + 5013 offset = transitioned_kind * kPointerSize +
5048 FixedArrayBase::kHeaderSize; 5014 FixedArrayBase::kHeaderSize;
5049 ld(map_in_out, FieldMemOperand(scratch, offset)); 5015 ld(map_in_out, FieldMemOperand(scratch, offset));
5050 } 5016 }
5051 5017
5052 5018
5053 void MacroAssembler::LoadGlobalFunction(int index, Register function) { 5019 void MacroAssembler::LoadNativeContextSlot(int index, Register dst) {
5054 // Load the global or builtins object from the current context. 5020 ld(dst, NativeContextMemOperand());
5055 ld(function, 5021 ld(dst, ContextMemOperand(dst, index));
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)));
5061 } 5022 }
5062 5023
5063 5024
5064 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 5025 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
5065 Register map, 5026 Register map,
5066 Register scratch) { 5027 Register scratch) {
5067 // Load the initial map. The global functions all have initial maps. 5028 // Load the initial map. The global functions all have initial maps.
5068 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 5029 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
5069 if (emit_debug_code()) { 5030 if (emit_debug_code()) {
5070 Label ok, fail; 5031 Label ok, fail;
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6284 if (mag.shift > 0) sra(result, result, mag.shift); 6245 if (mag.shift > 0) sra(result, result, mag.shift);
6285 srl(at, dividend, 31); 6246 srl(at, dividend, 31);
6286 Addu(result, result, Operand(at)); 6247 Addu(result, result, Operand(at));
6287 } 6248 }
6288 6249
6289 6250
6290 } // namespace internal 6251 } // namespace internal
6291 } // namespace v8 6252 } // namespace v8
6292 6253
6293 #endif // V8_TARGET_ARCH_MIPS64 6254 #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