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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 149133004: A64: Synchronize with r17807. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } else if (op->IsDoubleRegister()) { 481 } else if (op->IsDoubleRegister()) {
482 Abort(kToOperandIsDoubleRegisterUnimplemented); 482 Abort(kToOperandIsDoubleRegisterUnimplemented);
483 return Operand(0); 483 return Operand(0);
484 } 484 }
485 // Stack slots not implemented, use ToMemOperand instead. 485 // Stack slots not implemented, use ToMemOperand instead.
486 UNREACHABLE(); 486 UNREACHABLE();
487 return Operand(0); 487 return Operand(0);
488 } 488 }
489 489
490 490
491 static int ArgumentsOffsetWithoutFrame(int index) {
492 ASSERT(index < 0);
493 return -(index + 1) * kPointerSize;
494 }
495
496
491 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { 497 MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
492 ASSERT(!op->IsRegister()); 498 ASSERT(!op->IsRegister());
493 ASSERT(!op->IsDoubleRegister()); 499 ASSERT(!op->IsDoubleRegister());
494 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); 500 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
495 return MemOperand(fp, StackSlotOffset(op->index())); 501 if (NeedsEagerFrame()) {
502 return MemOperand(fp, StackSlotOffset(op->index()));
503 } else {
504 // Retrieve parameter without eager stack-frame relative to the
505 // stack-pointer.
506 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index()));
507 }
496 } 508 }
497 509
498 510
499 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { 511 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
500 ASSERT(op->IsDoubleStackSlot()); 512 ASSERT(op->IsDoubleStackSlot());
501 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); 513 if (NeedsEagerFrame()) {
514 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
515 } else {
516 // Retrieve parameter without eager stack-frame relative to the
517 // stack-pointer.
518 return MemOperand(
519 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize);
520 }
502 } 521 }
503 522
504 523
505 void LCodeGen::WriteTranslation(LEnvironment* environment, 524 void LCodeGen::WriteTranslation(LEnvironment* environment,
506 Translation* translation) { 525 Translation* translation) {
507 if (environment == NULL) return; 526 if (environment == NULL) return;
508 527
509 // The translation includes one command per value in the environment. 528 // The translation includes one command per value in the environment.
510 int translation_size = environment->translation_size(); 529 int translation_size = environment->translation_size();
511 // The output frame height does not include the parameters. 530 // The output frame height does not include the parameters.
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 condition, src1, src2); 2051 condition, src1, src2);
2033 } else { 2052 } else {
2034 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, 2053 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL,
2035 condition, src1, src2); 2054 condition, src1, src2);
2036 __ Branch(chunk_->GetAssemblyLabel(right_block)); 2055 __ Branch(chunk_->GetAssemblyLabel(right_block));
2037 } 2056 }
2038 } 2057 }
2039 2058
2040 2059
2041 template<class InstrType> 2060 template<class InstrType>
2061 void LCodeGen::EmitFalseBranch(InstrType instr,
2062 Condition condition,
2063 Register src1,
2064 const Operand& src2) {
2065 int false_block = instr->FalseDestination(chunk_);
2066 __ Branch(chunk_->GetAssemblyLabel(false_block), condition, src1, src2);
2067 }
2068
2069
2070 template<class InstrType>
2042 void LCodeGen::EmitFalseBranchF(InstrType instr, 2071 void LCodeGen::EmitFalseBranchF(InstrType instr,
2043 Condition condition, 2072 Condition condition,
2044 FPURegister src1, 2073 FPURegister src1,
2045 FPURegister src2) { 2074 FPURegister src2) {
2046 int false_block = instr->FalseDestination(chunk_); 2075 int false_block = instr->FalseDestination(chunk_);
2047 __ BranchF(chunk_->GetAssemblyLabel(false_block), NULL, 2076 __ BranchF(chunk_->GetAssemblyLabel(false_block), NULL,
2048 condition, src1, src2); 2077 condition, src1, src2);
2049 } 2078 }
2050 2079
2051 2080
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 2333
2305 DoubleRegister input_reg = ToDoubleRegister(instr->object()); 2334 DoubleRegister input_reg = ToDoubleRegister(instr->object());
2306 EmitFalseBranchF(instr, eq, input_reg, input_reg); 2335 EmitFalseBranchF(instr, eq, input_reg, input_reg);
2307 2336
2308 Register scratch = scratch0(); 2337 Register scratch = scratch0();
2309 __ FmoveHigh(scratch, input_reg); 2338 __ FmoveHigh(scratch, input_reg);
2310 EmitBranch(instr, eq, scratch, Operand(kHoleNanUpper32)); 2339 EmitBranch(instr, eq, scratch, Operand(kHoleNanUpper32));
2311 } 2340 }
2312 2341
2313 2342
2343 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
2344 Representation rep = instr->hydrogen()->value()->representation();
2345 ASSERT(!rep.IsInteger32());
2346 Register scratch = ToRegister(instr->temp());
2347
2348 if (rep.IsDouble()) {
2349 DoubleRegister value = ToDoubleRegister(instr->value());
2350 EmitFalseBranchF(instr, ne, value, kDoubleRegZero);
2351 __ FmoveHigh(scratch, value);
2352 __ li(at, 0x80000000);
2353 } else {
2354 Register value = ToRegister(instr->value());
2355 __ CheckMap(value,
2356 scratch,
2357 Heap::kHeapNumberMapRootIndex,
2358 instr->FalseLabel(chunk()),
2359 DO_SMI_CHECK);
2360 __ lw(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
2361 EmitFalseBranch(instr, ne, scratch, Operand(0x80000000));
2362 __ lw(scratch, FieldMemOperand(value, HeapNumber::kMantissaOffset));
2363 __ mov(at, zero_reg);
2364 }
2365 EmitBranch(instr, eq, scratch, Operand(at));
2366 }
2367
2368
2314 Condition LCodeGen::EmitIsObject(Register input, 2369 Condition LCodeGen::EmitIsObject(Register input,
2315 Register temp1, 2370 Register temp1,
2316 Register temp2, 2371 Register temp2,
2317 Label* is_not_object, 2372 Label* is_not_object,
2318 Label* is_object) { 2373 Label* is_object) {
2319 __ JumpIfSmi(input, is_not_object); 2374 __ JumpIfSmi(input, is_not_object);
2320 2375
2321 __ LoadRoot(temp2, Heap::kNullValueRootIndex); 2376 __ LoadRoot(temp2, Heap::kNullValueRootIndex);
2322 __ Branch(is_object, eq, input, Operand(temp2)); 2377 __ Branch(is_object, eq, input, Operand(temp2));
2323 2378
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 } 4027 }
3973 4028
3974 4029
3975 void LCodeGen::DoCallFunction(LCallFunction* instr) { 4030 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3976 ASSERT(ToRegister(instr->context()).is(cp)); 4031 ASSERT(ToRegister(instr->context()).is(cp));
3977 ASSERT(ToRegister(instr->function()).is(a1)); 4032 ASSERT(ToRegister(instr->function()).is(a1));
3978 ASSERT(ToRegister(instr->result()).is(v0)); 4033 ASSERT(ToRegister(instr->result()).is(v0));
3979 4034
3980 int arity = instr->arity(); 4035 int arity = instr->arity();
3981 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 4036 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
3982 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 4037 if (instr->hydrogen()->IsTailCall()) {
4038 if (NeedsEagerFrame()) __ mov(sp, fp);
4039 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
4040 } else {
4041 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4042 }
3983 } 4043 }
3984 4044
3985 4045
3986 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 4046 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
3987 ASSERT(ToRegister(instr->context()).is(cp)); 4047 ASSERT(ToRegister(instr->context()).is(cp));
3988 ASSERT(ToRegister(instr->result()).is(v0)); 4048 ASSERT(ToRegister(instr->result()).is(v0));
3989 4049
3990 int arity = instr->arity(); 4050 int arity = instr->arity();
3991 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; 4051 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
3992 Handle<Code> ic = 4052 Handle<Code> ic =
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
4473 Label no_memento_found; 4533 Label no_memento_found;
4474 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found, 4534 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found,
4475 ne, &no_memento_found); 4535 ne, &no_memento_found);
4476 DeoptimizeIf(al, instr->environment()); 4536 DeoptimizeIf(al, instr->environment());
4477 __ bind(&no_memento_found); 4537 __ bind(&no_memento_found);
4478 } 4538 }
4479 4539
4480 4540
4481 void LCodeGen::DoStringAdd(LStringAdd* instr) { 4541 void LCodeGen::DoStringAdd(LStringAdd* instr) {
4482 ASSERT(ToRegister(instr->context()).is(cp)); 4542 ASSERT(ToRegister(instr->context()).is(cp));
4483 __ push(ToRegister(instr->left())); 4543 if (FLAG_new_string_add) {
4484 __ push(ToRegister(instr->right())); 4544 ASSERT(ToRegister(instr->left()).is(a1));
4485 StringAddStub stub(instr->hydrogen()->flags()); 4545 ASSERT(ToRegister(instr->right()).is(a0));
4486 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 4546 NewStringAddStub stub(instr->hydrogen()->flags(),
4547 isolate()->heap()->GetPretenureMode());
4548 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4549 } else {
4550 __ push(ToRegister(instr->left()));
4551 __ push(ToRegister(instr->right()));
4552 StringAddStub stub(instr->hydrogen()->flags());
4553 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4554 }
4487 } 4555 }
4488 4556
4489 4557
4490 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { 4558 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
4491 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { 4559 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode {
4492 public: 4560 public:
4493 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) 4561 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr)
4494 : LDeferredCode(codegen), instr_(instr) { } 4562 : LDeferredCode(codegen), instr_(instr) { }
4495 virtual void Generate() V8_OVERRIDE { 4563 virtual void Generate() V8_OVERRIDE {
4496 codegen()->DoDeferredStringCharCodeAt(instr_); 4564 codegen()->DoDeferredStringCharCodeAt(instr_);
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
5360 if (instr->size()->IsRegister()) { 5428 if (instr->size()->IsRegister()) {
5361 Register size = ToRegister(instr->size()); 5429 Register size = ToRegister(instr->size());
5362 ASSERT(!size.is(result)); 5430 ASSERT(!size.is(result));
5363 __ SmiTag(size); 5431 __ SmiTag(size);
5364 __ push(size); 5432 __ push(size);
5365 } else { 5433 } else {
5366 int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); 5434 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5367 __ Push(Smi::FromInt(size)); 5435 __ Push(Smi::FromInt(size));
5368 } 5436 }
5369 5437
5438 int flags = AllocateDoubleAlignFlag::encode(
5439 instr->hydrogen()->MustAllocateDoubleAligned());
5370 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) { 5440 if (instr->hydrogen()->IsOldPointerSpaceAllocation()) {
5371 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation()); 5441 ASSERT(!instr->hydrogen()->IsOldDataSpaceAllocation());
5372 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 5442 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5373 CallRuntimeFromDeferred(Runtime::kAllocateInOldPointerSpace, 1, instr, 5443 flags = AllocateTargetSpace::update(flags, OLD_POINTER_SPACE);
5374 instr->context());
5375 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) { 5444 } else if (instr->hydrogen()->IsOldDataSpaceAllocation()) {
5376 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation()); 5445 ASSERT(!instr->hydrogen()->IsNewSpaceAllocation());
5377 CallRuntimeFromDeferred(Runtime::kAllocateInOldDataSpace, 1, instr, 5446 flags = AllocateTargetSpace::update(flags, OLD_DATA_SPACE);
5378 instr->context());
5379 } else { 5447 } else {
5380 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr, 5448 flags = AllocateTargetSpace::update(flags, NEW_SPACE);
5381 instr->context());
5382 } 5449 }
5450 __ Push(Smi::FromInt(flags));
5451
5452 CallRuntimeFromDeferred(
5453 Runtime::kAllocateInTargetSpace, 2, instr, instr->context());
5383 __ StoreToSafepointRegisterSlot(v0, result); 5454 __ StoreToSafepointRegisterSlot(v0, result);
5384 } 5455 }
5385 5456
5386 5457
5387 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5458 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5388 ASSERT(ToRegister(instr->value()).is(a0)); 5459 ASSERT(ToRegister(instr->value()).is(a0));
5389 ASSERT(ToRegister(instr->result()).is(v0)); 5460 ASSERT(ToRegister(instr->result()).is(v0));
5390 __ push(a0); 5461 __ push(a0);
5391 CallRuntime(Runtime::kToFastProperties, 1, instr); 5462 CallRuntime(Runtime::kToFastProperties, 1, instr);
5392 } 5463 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
5846 __ Subu(scratch, result, scratch); 5917 __ Subu(scratch, result, scratch);
5847 __ lw(result, FieldMemOperand(scratch, 5918 __ lw(result, FieldMemOperand(scratch,
5848 FixedArray::kHeaderSize - kPointerSize)); 5919 FixedArray::kHeaderSize - kPointerSize));
5849 __ bind(&done); 5920 __ bind(&done);
5850 } 5921 }
5851 5922
5852 5923
5853 #undef __ 5924 #undef __
5854 5925
5855 } } // namespace v8::internal 5926 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698