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

Side by Side Diff: src/crankshaft/ppc/lithium-codegen-ppc.cc

Issue 1491433002: PPC: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@patch11
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 | « no previous file | src/full-codegen/ppc/full-codegen-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/crankshaft/ppc/lithium-codegen-ppc.h" 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/crankshaft/hydrogen-osr.h" 10 #include "src/crankshaft/hydrogen-osr.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int num_parameters = scope()->num_parameters(); 196 int num_parameters = scope()->num_parameters();
197 int first_parameter = scope()->has_this_declaration() ? -1 : 0; 197 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
198 for (int i = first_parameter; i < num_parameters; i++) { 198 for (int i = first_parameter; i < num_parameters; i++) {
199 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); 199 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
200 if (var->IsContextSlot()) { 200 if (var->IsContextSlot()) {
201 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 201 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
202 (num_parameters - 1 - i) * kPointerSize; 202 (num_parameters - 1 - i) * kPointerSize;
203 // Load parameter from stack. 203 // Load parameter from stack.
204 __ LoadP(r3, MemOperand(fp, parameter_offset)); 204 __ LoadP(r3, MemOperand(fp, parameter_offset));
205 // Store it in the context. 205 // Store it in the context.
206 MemOperand target = ContextOperand(cp, var->index()); 206 MemOperand target = ContextMemOperand(cp, var->index());
207 __ StoreP(r3, target, r0); 207 __ StoreP(r3, target, r0);
208 // Update the write barrier. This clobbers r6 and r3. 208 // Update the write barrier. This clobbers r6 and r3.
209 if (need_write_barrier) { 209 if (need_write_barrier) {
210 __ RecordWriteContextSlot(cp, target.offset(), r3, r6, 210 __ RecordWriteContextSlot(cp, target.offset(), r3, r6,
211 GetLinkRegisterState(), kSaveFPRegs); 211 GetLinkRegisterState(), kSaveFPRegs);
212 } else if (FLAG_debug_code) { 212 } else if (FLAG_debug_code) {
213 Label done; 213 Label done;
214 __ JumpIfInNewSpace(cp, r3, &done); 214 __ JumpIfInNewSpace(cp, r3, &done);
215 __ Abort(kExpectedNewSpaceObject); 215 __ Abort(kExpectedNewSpaceObject);
216 __ bind(&done); 216 __ bind(&done);
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 Handle<Code> ic = 2892 Handle<Code> ic =
2893 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), 2893 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(),
2894 SLOPPY, PREMONOMORPHIC).code(); 2894 SLOPPY, PREMONOMORPHIC).code();
2895 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2895 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2896 } 2896 }
2897 2897
2898 2898
2899 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 2899 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2900 Register context = ToRegister(instr->context()); 2900 Register context = ToRegister(instr->context());
2901 Register result = ToRegister(instr->result()); 2901 Register result = ToRegister(instr->result());
2902 __ LoadP(result, ContextOperand(context, instr->slot_index())); 2902 __ LoadP(result, ContextMemOperand(context, instr->slot_index()));
2903 if (instr->hydrogen()->RequiresHoleCheck()) { 2903 if (instr->hydrogen()->RequiresHoleCheck()) {
2904 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 2904 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2905 if (instr->hydrogen()->DeoptimizesOnHole()) { 2905 if (instr->hydrogen()->DeoptimizesOnHole()) {
2906 __ cmp(result, ip); 2906 __ cmp(result, ip);
2907 DeoptimizeIf(eq, instr, Deoptimizer::kHole); 2907 DeoptimizeIf(eq, instr, Deoptimizer::kHole);
2908 } else { 2908 } else {
2909 if (CpuFeatures::IsSupported(ISELECT)) { 2909 if (CpuFeatures::IsSupported(ISELECT)) {
2910 Register scratch = scratch0(); 2910 Register scratch = scratch0();
2911 __ mov(scratch, Operand(factory()->undefined_value())); 2911 __ mov(scratch, Operand(factory()->undefined_value()));
2912 __ cmp(result, ip); 2912 __ cmp(result, ip);
2913 __ isel(eq, result, scratch, result); 2913 __ isel(eq, result, scratch, result);
2914 } else { 2914 } else {
2915 Label skip; 2915 Label skip;
2916 __ cmp(result, ip); 2916 __ cmp(result, ip);
2917 __ bne(&skip); 2917 __ bne(&skip);
2918 __ mov(result, Operand(factory()->undefined_value())); 2918 __ mov(result, Operand(factory()->undefined_value()));
2919 __ bind(&skip); 2919 __ bind(&skip);
2920 } 2920 }
2921 } 2921 }
2922 } 2922 }
2923 } 2923 }
2924 2924
2925 2925
2926 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { 2926 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2927 Register context = ToRegister(instr->context()); 2927 Register context = ToRegister(instr->context());
2928 Register value = ToRegister(instr->value()); 2928 Register value = ToRegister(instr->value());
2929 Register scratch = scratch0(); 2929 Register scratch = scratch0();
2930 MemOperand target = ContextOperand(context, instr->slot_index()); 2930 MemOperand target = ContextMemOperand(context, instr->slot_index());
2931 2931
2932 Label skip_assignment; 2932 Label skip_assignment;
2933 2933
2934 if (instr->hydrogen()->RequiresHoleCheck()) { 2934 if (instr->hydrogen()->RequiresHoleCheck()) {
2935 __ LoadP(scratch, target); 2935 __ LoadP(scratch, target);
2936 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 2936 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
2937 __ cmp(scratch, ip); 2937 __ cmp(scratch, ip);
2938 if (instr->hydrogen()->DeoptimizesOnHole()) { 2938 if (instr->hydrogen()->DeoptimizesOnHole()) {
2939 DeoptimizeIf(eq, instr, Deoptimizer::kHole); 2939 DeoptimizeIf(eq, instr, Deoptimizer::kHole);
2940 } else { 2940 } else {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3462 3462
3463 // Deoptimize if the receiver is not a JS object. 3463 // Deoptimize if the receiver is not a JS object.
3464 __ TestIfSmi(receiver, r0); 3464 __ TestIfSmi(receiver, r0);
3465 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, cr0); 3465 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, cr0);
3466 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_RECEIVER_TYPE); 3466 __ CompareObjectType(receiver, scratch, scratch, FIRST_JS_RECEIVER_TYPE);
3467 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject); 3467 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject);
3468 3468
3469 __ b(&result_in_receiver); 3469 __ b(&result_in_receiver);
3470 __ bind(&global_object); 3470 __ bind(&global_object);
3471 __ LoadP(result, FieldMemOperand(function, JSFunction::kContextOffset)); 3471 __ LoadP(result, FieldMemOperand(function, JSFunction::kContextOffset));
3472 __ LoadP(result, ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); 3472 __ LoadP(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX));
3473 __ LoadP(result, FieldMemOperand(result, JSGlobalObject::kGlobalProxyOffset)); 3473 __ LoadP(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX));
3474
3474 if (result.is(receiver)) { 3475 if (result.is(receiver)) {
3475 __ bind(&result_in_receiver); 3476 __ bind(&result_in_receiver);
3476 } else { 3477 } else {
3477 Label result_ok; 3478 Label result_ok;
3478 __ b(&result_ok); 3479 __ b(&result_ok);
3479 __ bind(&result_in_receiver); 3480 __ bind(&result_in_receiver);
3480 __ mr(result, receiver); 3481 __ mr(result, receiver);
3481 __ bind(&result_ok); 3482 __ bind(&result_ok);
3482 } 3483 }
3483 } 3484 }
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after
5992 __ Push(scope_info); 5993 __ Push(scope_info);
5993 __ push(ToRegister(instr->function())); 5994 __ push(ToRegister(instr->function()));
5994 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5995 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5995 RecordSafepoint(Safepoint::kNoLazyDeopt); 5996 RecordSafepoint(Safepoint::kNoLazyDeopt);
5996 } 5997 }
5997 5998
5998 5999
5999 #undef __ 6000 #undef __
6000 } // namespace internal 6001 } // namespace internal
6001 } // namespace v8 6002 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698