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

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

Issue 1460503008: [turbofan] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-pass-new-target-6
Patch Set: Ported to MIPS64. 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/runtime/runtime-function.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 4236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 } 4247 }
4248 } else { 4248 } else {
4249 Jump(adaptor, RelocInfo::CODE_TARGET); 4249 Jump(adaptor, RelocInfo::CODE_TARGET);
4250 } 4250 }
4251 bind(&regular_invoke); 4251 bind(&regular_invoke);
4252 } 4252 }
4253 } 4253 }
4254 4254
4255 4255
4256 void MacroAssembler::InvokeCode(Register code, 4256 void MacroAssembler::InvokeCode(Register code,
4257 Register new_target,
4257 const ParameterCount& expected, 4258 const ParameterCount& expected,
4258 const ParameterCount& actual, 4259 const ParameterCount& actual,
4259 InvokeFlag flag, 4260 InvokeFlag flag,
4260 const CallWrapper& call_wrapper) { 4261 const CallWrapper& call_wrapper) {
4261 // You can't call a function without a valid frame. 4262 // You can't call a function without a valid frame.
4262 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4263 DCHECK(flag == JUMP_FUNCTION || has_frame());
4263 4264
4265 // Ensure new target is passed in the correct register. Otherwise clear the
4266 // appropriate register in case new target is not given.
4267 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(a3));
4268 if (!new_target.is_valid()) {
4269 LoadRoot(a3, Heap::kUndefinedValueRootIndex);
4270 }
4271
4264 Label done; 4272 Label done;
4265
4266 bool definitely_mismatches = false; 4273 bool definitely_mismatches = false;
4267 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, 4274 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag,
4268 call_wrapper); 4275 call_wrapper);
4269 if (!definitely_mismatches) { 4276 if (!definitely_mismatches) {
4270 if (flag == CALL_FUNCTION) { 4277 if (flag == CALL_FUNCTION) {
4271 call_wrapper.BeforeCall(CallSize(code)); 4278 call_wrapper.BeforeCall(CallSize(code));
4272 Call(code); 4279 Call(code);
4273 call_wrapper.AfterCall(); 4280 call_wrapper.AfterCall();
4274 } else { 4281 } else {
4275 DCHECK(flag == JUMP_FUNCTION); 4282 DCHECK(flag == JUMP_FUNCTION);
4276 Jump(code); 4283 Jump(code);
4277 } 4284 }
4278 // Continue here if InvokePrologue does handle the invocation due to 4285 // Continue here if InvokePrologue does handle the invocation due to
4279 // mismatched parameter counts. 4286 // mismatched parameter counts.
4280 bind(&done); 4287 bind(&done);
4281 } 4288 }
4282 } 4289 }
4283 4290
4284 4291
4285 void MacroAssembler::InvokeFunction(Register function, 4292 void MacroAssembler::InvokeFunction(Register function,
4293 Register new_target,
4286 const ParameterCount& actual, 4294 const ParameterCount& actual,
4287 InvokeFlag flag, 4295 InvokeFlag flag,
4288 const CallWrapper& call_wrapper) { 4296 const CallWrapper& call_wrapper) {
4289 // You can't call a function without a valid frame. 4297 // You can't call a function without a valid frame.
4290 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4298 DCHECK(flag == JUMP_FUNCTION || has_frame());
4291 4299
4292 // Contract with called JS functions requires that function is passed in a1. 4300 // Contract with called JS functions requires that function is passed in a1.
4293 DCHECK(function.is(a1)); 4301 DCHECK(function.is(a1));
4294 Register expected_reg = a2; 4302 Register expected_reg = a2;
4295 Register code_reg = a3; 4303 Register code_reg = t0;
4296 ld(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 4304 ld(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
4297 ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 4305 ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
4298 // The argument count is stored as int32_t on 64-bit platforms. 4306 // The argument count is stored as int32_t on 64-bit platforms.
4299 // TODO(plind): Smi on 32-bit platforms. 4307 // TODO(plind): Smi on 32-bit platforms.
4300 lw(expected_reg, 4308 lw(expected_reg,
4301 FieldMemOperand(code_reg, 4309 FieldMemOperand(code_reg,
4302 SharedFunctionInfo::kFormalParameterCountOffset)); 4310 SharedFunctionInfo::kFormalParameterCountOffset));
4303 ld(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 4311 ld(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4304 ParameterCount expected(expected_reg); 4312 ParameterCount expected(expected_reg);
4305 InvokeCode(code_reg, expected, actual, flag, call_wrapper); 4313 InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper);
4306 } 4314 }
4307 4315
4308 4316
4309 void MacroAssembler::InvokeFunction(Register function, 4317 void MacroAssembler::InvokeFunction(Register function,
4310 const ParameterCount& expected, 4318 const ParameterCount& expected,
4311 const ParameterCount& actual, 4319 const ParameterCount& actual,
4312 InvokeFlag flag, 4320 InvokeFlag flag,
4313 const CallWrapper& call_wrapper) { 4321 const CallWrapper& call_wrapper) {
4314 // You can't call a function without a valid frame. 4322 // You can't call a function without a valid frame.
4315 DCHECK(flag == JUMP_FUNCTION || has_frame()); 4323 DCHECK(flag == JUMP_FUNCTION || has_frame());
4316 4324
4317 // Contract with called JS functions requires that function is passed in a1. 4325 // Contract with called JS functions requires that function is passed in a1.
4318 DCHECK(function.is(a1)); 4326 DCHECK(function.is(a1));
4319 4327
4320 // Get the function and setup the context. 4328 // Get the function and setup the context.
4321 ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 4329 ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
4322 4330
4323 // We call indirectly through the code field in the function to 4331 // We call indirectly through the code field in the function to
4324 // allow recompilation to take effect without changing any of the 4332 // allow recompilation to take effect without changing any of the
4325 // call sites. 4333 // call sites.
4326 ld(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 4334 ld(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
4327 InvokeCode(a3, expected, actual, flag, call_wrapper); 4335 InvokeCode(t0, no_reg, expected, actual, flag, call_wrapper);
4328 } 4336 }
4329 4337
4330 4338
4331 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 4339 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
4332 const ParameterCount& expected, 4340 const ParameterCount& expected,
4333 const ParameterCount& actual, 4341 const ParameterCount& actual,
4334 InvokeFlag flag, 4342 InvokeFlag flag,
4335 const CallWrapper& call_wrapper) { 4343 const CallWrapper& call_wrapper) {
4336 li(a1, function); 4344 li(a1, function);
4337 InvokeFunction(a1, expected, actual, flag, call_wrapper); 4345 InvokeFunction(a1, expected, actual, flag, call_wrapper);
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
6262 if (mag.shift > 0) sra(result, result, mag.shift); 6270 if (mag.shift > 0) sra(result, result, mag.shift);
6263 srl(at, dividend, 31); 6271 srl(at, dividend, 31);
6264 Addu(result, result, Operand(at)); 6272 Addu(result, result, Operand(at));
6265 } 6273 }
6266 6274
6267 6275
6268 } // namespace internal 6276 } // namespace internal
6269 } // namespace v8 6277 } // namespace v8
6270 6278
6271 #endif // V8_TARGET_ARCH_MIPS64 6279 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698