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

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

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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-mips.h ('k') | src/mips/simulator-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 23 matching lines...) Expand all
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 #define DEFINE_COMPILE(type) \ 37 #define DEFINE_COMPILE(type) \
38 void L##type::CompileToNative(LCodeGen* generator) { \ 38 void L##type::CompileToNative(LCodeGen* generator) { \
39 generator->Do##type(this); \ 39 generator->Do##type(this); \
40 } 40 }
41 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) 41 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
42 #undef DEFINE_COMPILE 42 #undef DEFINE_COMPILE
43 43
44 LOsrEntry::LOsrEntry() {
45 for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) {
46 register_spills_[i] = NULL;
47 }
48 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) {
49 double_register_spills_[i] = NULL;
50 }
51 }
52
53
54 void LOsrEntry::MarkSpilledRegister(int allocation_index,
55 LOperand* spill_operand) {
56 ASSERT(spill_operand->IsStackSlot());
57 ASSERT(register_spills_[allocation_index] == NULL);
58 register_spills_[allocation_index] = spill_operand;
59 }
60
61
62 #ifdef DEBUG 44 #ifdef DEBUG
63 void LInstruction::VerifyCall() { 45 void LInstruction::VerifyCall() {
64 // Call instructions can use only fixed registers as temporaries and 46 // Call instructions can use only fixed registers as temporaries and
65 // outputs because all registers are blocked by the calling convention. 47 // outputs because all registers are blocked by the calling convention.
66 // Inputs operands must use a fixed register or use-at-start policy or 48 // Inputs operands must use a fixed register or use-at-start policy or
67 // a non-register policy. 49 // a non-register policy.
68 ASSERT(Output() == NULL || 50 ASSERT(Output() == NULL ||
69 LUnallocated::cast(Output())->HasFixedPolicy() || 51 LUnallocated::cast(Output())->HasFixedPolicy() ||
70 !LUnallocated::cast(Output())->HasRegisterPolicy()); 52 !LUnallocated::cast(Output())->HasRegisterPolicy());
71 for (UseIterator it(this); !it.Done(); it.Advance()) { 53 for (UseIterator it(this); !it.Done(); it.Advance()) {
72 LUnallocated* operand = LUnallocated::cast(it.Current()); 54 LUnallocated* operand = LUnallocated::cast(it.Current());
73 ASSERT(operand->HasFixedPolicy() || 55 ASSERT(operand->HasFixedPolicy() ||
74 operand->IsUsedAtStart()); 56 operand->IsUsedAtStart());
75 } 57 }
76 for (TempIterator it(this); !it.Done(); it.Advance()) { 58 for (TempIterator it(this); !it.Done(); it.Advance()) {
77 LUnallocated* operand = LUnallocated::cast(it.Current()); 59 LUnallocated* operand = LUnallocated::cast(it.Current());
78 ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); 60 ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy());
79 } 61 }
80 } 62 }
81 #endif 63 #endif
82 64
83 65
84 void LOsrEntry::MarkSpilledDoubleRegister(int allocation_index,
85 LOperand* spill_operand) {
86 ASSERT(spill_operand->IsDoubleStackSlot());
87 ASSERT(double_register_spills_[allocation_index] == NULL);
88 double_register_spills_[allocation_index] = spill_operand;
89 }
90
91
92 void LInstruction::PrintTo(StringStream* stream) { 66 void LInstruction::PrintTo(StringStream* stream) {
93 stream->Add("%s ", this->Mnemonic()); 67 stream->Add("%s ", this->Mnemonic());
94 68
95 PrintOutputOperandTo(stream); 69 PrintOutputOperandTo(stream);
96 70
97 PrintDataTo(stream); 71 PrintDataTo(stream);
98 72
99 if (HasEnvironment()) { 73 if (HasEnvironment()) {
100 stream->Add(" "); 74 stream->Add(" ");
101 environment()->PrintTo(stream); 75 environment()->PrintTo(stream);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return LDoubleStackSlot::Create(index, zone()); 422 return LDoubleStackSlot::Create(index, zone());
449 } else { 423 } else {
450 return LStackSlot::Create(index, zone()); 424 return LStackSlot::Create(index, zone());
451 } 425 }
452 } 426 }
453 427
454 428
455 LPlatformChunk* LChunkBuilder::Build() { 429 LPlatformChunk* LChunkBuilder::Build() {
456 ASSERT(is_unused()); 430 ASSERT(is_unused());
457 chunk_ = new(zone()) LPlatformChunk(info(), graph()); 431 chunk_ = new(zone()) LPlatformChunk(info(), graph());
458 HPhase phase("L_Building chunk", chunk_); 432 LPhase phase("L_Building chunk", chunk_);
459 status_ = BUILDING; 433 status_ = BUILDING;
460 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 434 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
461 for (int i = 0; i < blocks->length(); i++) { 435 for (int i = 0; i < blocks->length(); i++) {
462 HBasicBlock* next = NULL; 436 HBasicBlock* next = NULL;
463 if (i < blocks->length() - 1) next = blocks->at(i + 1); 437 if (i < blocks->length() - 1) next = blocks->at(i + 1);
464 DoBasicBlock(blocks->at(i), next); 438 DoBasicBlock(blocks->at(i), next);
465 if (is_aborted()) return NULL; 439 if (is_aborted()) return NULL;
466 } 440 }
467 status_ = DONE; 441 status_ = DONE;
468 return chunk_; 442 return chunk_;
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 HValue* value = instr->value(); 970 HValue* value = instr->value();
997 if (value->EmitAtUses()) { 971 if (value->EmitAtUses()) {
998 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() 972 HBasicBlock* successor = HConstant::cast(value)->BooleanValue()
999 ? instr->FirstSuccessor() 973 ? instr->FirstSuccessor()
1000 : instr->SecondSuccessor(); 974 : instr->SecondSuccessor();
1001 return new(zone()) LGoto(successor->block_id()); 975 return new(zone()) LGoto(successor->block_id());
1002 } 976 }
1003 977
1004 LBranch* result = new(zone()) LBranch(UseRegister(value)); 978 LBranch* result = new(zone()) LBranch(UseRegister(value));
1005 // Tagged values that are not known smis or booleans require a 979 // Tagged values that are not known smis or booleans require a
1006 // deoptimization environment. 980 // deoptimization environment. If the instruction is generic no
981 // environment is needed since all cases are handled.
1007 Representation rep = value->representation(); 982 Representation rep = value->representation();
1008 HType type = value->type(); 983 HType type = value->type();
1009 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) { 984 ToBooleanStub::Types expected = instr->expected_input_types();
985 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() &&
986 !expected.IsGeneric()) {
1010 return AssignEnvironment(result); 987 return AssignEnvironment(result);
1011 } 988 }
1012 return result; 989 return result;
1013 } 990 }
1014 991
1015 992
1016 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { 993 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1017 ASSERT(instr->value()->representation().IsTagged()); 994 ASSERT(instr->value()->representation().IsTagged());
1018 LOperand* value = UseRegisterAtStart(instr->value()); 995 LOperand* value = UseRegisterAtStart(instr->value());
1019 LOperand* temp = TempRegister(); 996 LOperand* temp = TempRegister();
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 ASSERT(right->representation().IsInteger32()); 1407 ASSERT(right->representation().IsInteger32());
1431 if (instr->HasPowerOf2Divisor()) { 1408 if (instr->HasPowerOf2Divisor()) {
1432 ASSERT(!right->CanBeZero()); 1409 ASSERT(!right->CanBeZero());
1433 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), 1410 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
1434 UseOrConstant(right)); 1411 UseOrConstant(right));
1435 LInstruction* result = DefineAsRegister(mod); 1412 LInstruction* result = DefineAsRegister(mod);
1436 return (left->CanBeNegative() && 1413 return (left->CanBeNegative() &&
1437 instr->CheckFlag(HValue::kBailoutOnMinusZero)) 1414 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1438 ? AssignEnvironment(result) 1415 ? AssignEnvironment(result)
1439 : result; 1416 : result;
1417 } else if (instr->fixed_right_arg().has_value) {
1418 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
1419 UseRegisterAtStart(right));
1420 return AssignEnvironment(DefineAsRegister(mod));
1440 } else { 1421 } else {
1441 LModI* mod = new(zone()) LModI(UseRegister(left), 1422 LModI* mod = new(zone()) LModI(UseRegister(left),
1442 UseRegister(right), 1423 UseRegister(right),
1443 TempRegister(), 1424 TempRegister(),
1444 FixedTemp(f20), 1425 FixedTemp(f20),
1445 FixedTemp(f22)); 1426 FixedTemp(f22));
1446 LInstruction* result = DefineAsRegister(mod); 1427 LInstruction* result = DefineAsRegister(mod);
1447 return (right->CanBeZero() || 1428 return (right->CanBeZero() ||
1448 (left->RangeCanInclude(kMinInt) && 1429 (left->RangeCanInclude(kMinInt) &&
1449 right->RangeCanInclude(-1)) || 1430 right->RangeCanInclude(-1)) ||
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 return DefineAsRegister( 1913 return DefineAsRegister(
1933 new(zone()) LInteger32ToDouble(Use(instr->value()))); 1914 new(zone()) LInteger32ToDouble(Use(instr->value())));
1934 } 1915 }
1935 } 1916 }
1936 } 1917 }
1937 UNREACHABLE(); 1918 UNREACHABLE();
1938 return NULL; 1919 return NULL;
1939 } 1920 }
1940 1921
1941 1922
1942 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1923 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) {
1943 LOperand* value = UseRegisterAtStart(instr->value()); 1924 LOperand* value = UseRegisterAtStart(instr->value());
1944 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); 1925 return AssignEnvironment(new(zone()) LCheckNonSmi(value));
1945 } 1926 }
1946 1927
1947 1928
1948 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { 1929 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1949 LOperand* value = UseRegisterAtStart(instr->value()); 1930 LOperand* value = UseRegisterAtStart(instr->value());
1950 LInstruction* result = new(zone()) LCheckInstanceType(value); 1931 LInstruction* result = new(zone()) LCheckInstanceType(value);
1951 return AssignEnvironment(result); 1932 return AssignEnvironment(result);
1952 } 1933 }
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 return AssignPointerMap(DefineAsRegister(result)); 2312 return AssignPointerMap(DefineAsRegister(result));
2332 } 2313 }
2333 2314
2334 2315
2335 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { 2316 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2336 LOperand* string = UseRegisterAtStart(instr->value()); 2317 LOperand* string = UseRegisterAtStart(instr->value());
2337 return DefineAsRegister(new(zone()) LStringLength(string)); 2318 return DefineAsRegister(new(zone()) LStringLength(string));
2338 } 2319 }
2339 2320
2340 2321
2322 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2323 info()->MarkAsDeferredCalling();
2324 LAllocateObject* result =
2325 new(zone()) LAllocateObject(TempRegister(), TempRegister());
2326 return AssignPointerMap(DefineAsRegister(result));
2327 }
2328
2329
2341 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { 2330 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2342 info()->MarkAsDeferredCalling(); 2331 info()->MarkAsDeferredCalling();
2343 LOperand* size = instr->size()->IsConstant() 2332 LOperand* size = instr->size()->IsConstant()
2344 ? UseConstant(instr->size()) 2333 ? UseConstant(instr->size())
2345 : UseTempRegister(instr->size()); 2334 : UseTempRegister(instr->size());
2346 LOperand* temp1 = TempRegister(); 2335 LOperand* temp1 = TempRegister();
2347 LOperand* temp2 = TempRegister(); 2336 LOperand* temp2 = TempRegister();
2348 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); 2337 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2);
2349 return AssignPointerMap(DefineAsRegister(result)); 2338 return AssignPointerMap(DefineAsRegister(result));
2350 } 2339 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 2558
2570 2559
2571 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2560 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2572 LOperand* object = UseRegister(instr->object()); 2561 LOperand* object = UseRegister(instr->object());
2573 LOperand* index = UseRegister(instr->index()); 2562 LOperand* index = UseRegister(instr->index());
2574 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2563 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2575 } 2564 }
2576 2565
2577 2566
2578 } } // namespace v8::internal 2567 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/mips/simulator-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698