| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
| 44 V(ControlInstruction) \ | 44 V(ControlInstruction) \ |
| 45 V(Call) \ | 45 V(Call) \ |
| 46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) | 46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) |
| 47 | 47 |
| 48 | 48 |
| 49 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 49 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 50 V(AccessArgumentsAt) \ | 50 V(AccessArgumentsAt) \ |
| 51 V(AddI) \ | 51 V(AddI) \ |
| 52 V(Allocate) \ | 52 V(Allocate) \ |
| 53 V(AllocateObject) \ |
| 53 V(ApplyArguments) \ | 54 V(ApplyArguments) \ |
| 54 V(ArgumentsElements) \ | 55 V(ArgumentsElements) \ |
| 55 V(ArgumentsLength) \ | 56 V(ArgumentsLength) \ |
| 56 V(ArithmeticD) \ | 57 V(ArithmeticD) \ |
| 57 V(ArithmeticT) \ | 58 V(ArithmeticT) \ |
| 58 V(BitI) \ | 59 V(BitI) \ |
| 59 V(BitNotI) \ | 60 V(BitNotI) \ |
| 60 V(BoundsCheck) \ | 61 V(BoundsCheck) \ |
| 61 V(Branch) \ | 62 V(Branch) \ |
| 62 V(CallConstantFunction) \ | 63 V(CallConstantFunction) \ |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { | 483 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
| 483 public: | 484 public: |
| 484 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 485 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 485 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | 486 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
| 486 }; | 487 }; |
| 487 | 488 |
| 488 | 489 |
| 489 template<int I, int T> | 490 template<int I, int T> |
| 490 class LControlInstruction: public LTemplateInstruction<0, I, T> { | 491 class LControlInstruction: public LTemplateInstruction<0, I, T> { |
| 491 public: | 492 public: |
| 493 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } |
| 494 |
| 492 virtual bool IsControl() const { return true; } | 495 virtual bool IsControl() const { return true; } |
| 493 | 496 |
| 494 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | 497 int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
| 495 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | 498 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
| 496 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } | 499 |
| 497 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } | 500 int TrueDestination(LChunk* chunk) { |
| 501 return chunk->LookupDestination(true_block_id()); |
| 502 } |
| 503 int FalseDestination(LChunk* chunk) { |
| 504 return chunk->LookupDestination(false_block_id()); |
| 505 } |
| 506 |
| 507 Label* TrueLabel(LChunk* chunk) { |
| 508 if (true_label_ == NULL) { |
| 509 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); |
| 510 } |
| 511 return true_label_; |
| 512 } |
| 513 Label* FalseLabel(LChunk* chunk) { |
| 514 if (false_label_ == NULL) { |
| 515 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); |
| 516 } |
| 517 return false_label_; |
| 518 } |
| 519 |
| 520 protected: |
| 521 int true_block_id() { return SuccessorAt(0)->block_id(); } |
| 522 int false_block_id() { return SuccessorAt(1)->block_id(); } |
| 498 | 523 |
| 499 private: | 524 private: |
| 500 HControlInstruction* hydrogen() { | 525 HControlInstruction* hydrogen() { |
| 501 return HControlInstruction::cast(this->hydrogen_value()); | 526 return HControlInstruction::cast(this->hydrogen_value()); |
| 502 } | 527 } |
| 528 |
| 529 Label* false_label_; |
| 530 Label* true_label_; |
| 503 }; | 531 }; |
| 504 | 532 |
| 505 | 533 |
| 506 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { | 534 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { |
| 507 public: | 535 public: |
| 508 LWrapReceiver(LOperand* receiver, LOperand* function) { | 536 LWrapReceiver(LOperand* receiver, LOperand* function) { |
| 509 inputs_[0] = receiver; | 537 inputs_[0] = receiver; |
| 510 inputs_[1] = function; | 538 inputs_[1] = function; |
| 511 } | 539 } |
| 512 | 540 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 virtual void PrintDataTo(StringStream* stream); | 1211 virtual void PrintDataTo(StringStream* stream); |
| 1184 }; | 1212 }; |
| 1185 | 1213 |
| 1186 | 1214 |
| 1187 class LDebugBreak: public LTemplateInstruction<0, 0, 0> { | 1215 class LDebugBreak: public LTemplateInstruction<0, 0, 0> { |
| 1188 public: | 1216 public: |
| 1189 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") | 1217 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") |
| 1190 }; | 1218 }; |
| 1191 | 1219 |
| 1192 | 1220 |
| 1193 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { | 1221 class LCmpMapAndBranch: public LControlInstruction<1, 0> { |
| 1194 public: | 1222 public: |
| 1195 explicit LCmpMapAndBranch(LOperand* value) { | 1223 explicit LCmpMapAndBranch(LOperand* value) { |
| 1196 inputs_[0] = value; | 1224 inputs_[0] = value; |
| 1197 } | 1225 } |
| 1198 | 1226 |
| 1199 LOperand* value() { return inputs_[0]; } | 1227 LOperand* value() { return inputs_[0]; } |
| 1200 | 1228 |
| 1201 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1229 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1202 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1230 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
| 1203 | 1231 |
| 1204 virtual bool IsControl() const { return true; } | |
| 1205 | |
| 1206 Handle<Map> map() const { return hydrogen()->map(); } | 1232 Handle<Map> map() const { return hydrogen()->map(); } |
| 1207 int true_block_id() const { | |
| 1208 return hydrogen()->FirstSuccessor()->block_id(); | |
| 1209 } | |
| 1210 int false_block_id() const { | |
| 1211 return hydrogen()->SecondSuccessor()->block_id(); | |
| 1212 } | |
| 1213 }; | 1233 }; |
| 1214 | 1234 |
| 1215 | 1235 |
| 1216 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1236 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
| 1217 public: | 1237 public: |
| 1218 explicit LFixedArrayBaseLength(LOperand* value) { | 1238 explicit LFixedArrayBaseLength(LOperand* value) { |
| 1219 inputs_[0] = value; | 1239 inputs_[0] = value; |
| 1220 } | 1240 } |
| 1221 | 1241 |
| 1222 LOperand* value() { return inputs_[0]; } | 1242 LOperand* value() { return inputs_[0]; } |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 | 2372 |
| 2353 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { | 2373 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 2354 public: | 2374 public: |
| 2355 explicit LCheckNonSmi(LOperand* value) { | 2375 explicit LCheckNonSmi(LOperand* value) { |
| 2356 inputs_[0] = value; | 2376 inputs_[0] = value; |
| 2357 } | 2377 } |
| 2358 | 2378 |
| 2359 LOperand* value() { return inputs_[0]; } | 2379 LOperand* value() { return inputs_[0]; } |
| 2360 | 2380 |
| 2361 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2381 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2382 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
| 2362 }; | 2383 }; |
| 2363 | 2384 |
| 2364 | 2385 |
| 2386 class LAllocateObject: public LTemplateInstruction<1, 0, 1> { |
| 2387 public: |
| 2388 explicit LAllocateObject(LOperand* temp) { |
| 2389 temps_[0] = temp; |
| 2390 } |
| 2391 |
| 2392 LOperand* temp() { return temps_[0]; } |
| 2393 |
| 2394 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") |
| 2395 DECLARE_HYDROGEN_ACCESSOR(AllocateObject) |
| 2396 }; |
| 2397 |
| 2398 |
| 2365 class LAllocate: public LTemplateInstruction<1, 1, 1> { | 2399 class LAllocate: public LTemplateInstruction<1, 1, 1> { |
| 2366 public: | 2400 public: |
| 2367 LAllocate(LOperand* size, LOperand* temp) { | 2401 LAllocate(LOperand* size, LOperand* temp) { |
| 2368 inputs_[0] = size; | 2402 inputs_[0] = size; |
| 2369 temps_[0] = temp; | 2403 temps_[0] = temp; |
| 2370 } | 2404 } |
| 2371 | 2405 |
| 2372 LOperand* size() { return inputs_[0]; } | 2406 LOperand* size() { return inputs_[0]; } |
| 2373 LOperand* temp() { return temps_[0]; } | 2407 LOperand* temp() { return temps_[0]; } |
| 2374 | 2408 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 | 2490 |
| 2457 LOperand* object() { return inputs_[0]; } | 2491 LOperand* object() { return inputs_[0]; } |
| 2458 LOperand* key() { return inputs_[1]; } | 2492 LOperand* key() { return inputs_[1]; } |
| 2459 | 2493 |
| 2460 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") | 2494 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
| 2461 }; | 2495 }; |
| 2462 | 2496 |
| 2463 | 2497 |
| 2464 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { | 2498 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
| 2465 public: | 2499 public: |
| 2466 LOsrEntry(); | 2500 LOsrEntry() {} |
| 2467 | 2501 |
| 2468 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 2502 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 2469 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") | 2503 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2470 | |
| 2471 LOperand** SpilledRegisterArray() { return register_spills_; } | |
| 2472 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } | |
| 2473 | |
| 2474 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); | |
| 2475 void MarkSpilledDoubleRegister(int allocation_index, | |
| 2476 LOperand* spill_operand); | |
| 2477 | |
| 2478 private: | |
| 2479 // Arrays of spill slot operands for registers with an assigned spill | |
| 2480 // slot, i.e., that must also be restored to the spill slot on OSR entry. | |
| 2481 // NULL if the register has no assigned spill slot. Indexed by allocation | |
| 2482 // index. | |
| 2483 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters]; | |
| 2484 LOperand* double_register_spills_[ | |
| 2485 DoubleRegister::kMaxNumAllocatableRegisters]; | |
| 2486 }; | 2504 }; |
| 2487 | 2505 |
| 2488 | 2506 |
| 2489 class LStackCheck: public LTemplateInstruction<0, 0, 0> { | 2507 class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
| 2490 public: | 2508 public: |
| 2491 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | 2509 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
| 2492 DECLARE_HYDROGEN_ACCESSOR(StackCheck) | 2510 DECLARE_HYDROGEN_ACCESSOR(StackCheck) |
| 2493 | 2511 |
| 2494 Label* done_label() { return &done_label_; } | 2512 Label* done_label() { return &done_label_; } |
| 2495 | 2513 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 | 2752 |
| 2735 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2753 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2736 }; | 2754 }; |
| 2737 | 2755 |
| 2738 #undef DECLARE_HYDROGEN_ACCESSOR | 2756 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2739 #undef DECLARE_CONCRETE_INSTRUCTION | 2757 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2740 | 2758 |
| 2741 } } // namespace v8::int | 2759 } } // namespace v8::int |
| 2742 | 2760 |
| 2743 #endif // V8_X64_LITHIUM_X64_H_ | 2761 #endif // V8_X64_LITHIUM_X64_H_ |
| OLD | NEW |