| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 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(AllocateObject) \ |
| 52 V(Allocate) \ | 53 V(Allocate) \ |
| 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) \ |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { | 481 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
| 481 public: | 482 public: |
| 482 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 483 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 483 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | 484 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
| 484 }; | 485 }; |
| 485 | 486 |
| 486 | 487 |
| 487 template<int I, int T> | 488 template<int I, int T> |
| 488 class LControlInstruction: public LTemplateInstruction<0, I, T> { | 489 class LControlInstruction: public LTemplateInstruction<0, I, T> { |
| 489 public: | 490 public: |
| 491 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } |
| 492 |
| 490 virtual bool IsControl() const { return true; } | 493 virtual bool IsControl() const { return true; } |
| 491 | 494 |
| 492 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | 495 int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
| 493 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | 496 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
| 494 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } | 497 |
| 495 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } | 498 int TrueDestination(LChunk* chunk) { |
| 499 return chunk->LookupDestination(true_block_id()); |
| 500 } |
| 501 int FalseDestination(LChunk* chunk) { |
| 502 return chunk->LookupDestination(false_block_id()); |
| 503 } |
| 504 |
| 505 Label* TrueLabel(LChunk* chunk) { |
| 506 if (true_label_ == NULL) { |
| 507 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); |
| 508 } |
| 509 return true_label_; |
| 510 } |
| 511 Label* FalseLabel(LChunk* chunk) { |
| 512 if (false_label_ == NULL) { |
| 513 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); |
| 514 } |
| 515 return false_label_; |
| 516 } |
| 517 |
| 518 protected: |
| 519 int true_block_id() { return SuccessorAt(0)->block_id(); } |
| 520 int false_block_id() { return SuccessorAt(1)->block_id(); } |
| 496 | 521 |
| 497 private: | 522 private: |
| 498 HControlInstruction* hydrogen() { | 523 HControlInstruction* hydrogen() { |
| 499 return HControlInstruction::cast(this->hydrogen_value()); | 524 return HControlInstruction::cast(this->hydrogen_value()); |
| 500 } | 525 } |
| 526 |
| 527 Label* false_label_; |
| 528 Label* true_label_; |
| 501 }; | 529 }; |
| 502 | 530 |
| 503 | 531 |
| 504 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { | 532 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { |
| 505 public: | 533 public: |
| 506 LWrapReceiver(LOperand* receiver, LOperand* function) { | 534 LWrapReceiver(LOperand* receiver, LOperand* function) { |
| 507 inputs_[0] = receiver; | 535 inputs_[0] = receiver; |
| 508 inputs_[1] = function; | 536 inputs_[1] = function; |
| 509 } | 537 } |
| 510 | 538 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 | 1236 |
| 1209 LOperand* value() { return inputs_[0]; } | 1237 LOperand* value() { return inputs_[0]; } |
| 1210 | 1238 |
| 1211 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 1239 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 1212 DECLARE_HYDROGEN_ACCESSOR(Branch) | 1240 DECLARE_HYDROGEN_ACCESSOR(Branch) |
| 1213 | 1241 |
| 1214 virtual void PrintDataTo(StringStream* stream); | 1242 virtual void PrintDataTo(StringStream* stream); |
| 1215 }; | 1243 }; |
| 1216 | 1244 |
| 1217 | 1245 |
| 1218 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> { | 1246 class LCmpMapAndBranch: public LControlInstruction<1, 1> { |
| 1219 public: | 1247 public: |
| 1220 LCmpMapAndBranch(LOperand* value, LOperand* temp) { | 1248 LCmpMapAndBranch(LOperand* value, LOperand* temp) { |
| 1221 inputs_[0] = value; | 1249 inputs_[0] = value; |
| 1222 temps_[0] = temp; | 1250 temps_[0] = temp; |
| 1223 } | 1251 } |
| 1224 | 1252 |
| 1225 LOperand* value() { return inputs_[0]; } | 1253 LOperand* value() { return inputs_[0]; } |
| 1226 LOperand* temp() { return temps_[0]; } | 1254 LOperand* temp() { return temps_[0]; } |
| 1227 | 1255 |
| 1228 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1256 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1229 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1257 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
| 1230 | 1258 |
| 1231 virtual bool IsControl() const { return true; } | |
| 1232 | |
| 1233 Handle<Map> map() const { return hydrogen()->map(); } | 1259 Handle<Map> map() const { return hydrogen()->map(); } |
| 1234 int true_block_id() const { | |
| 1235 return hydrogen()->FirstSuccessor()->block_id(); | |
| 1236 } | |
| 1237 int false_block_id() const { | |
| 1238 return hydrogen()->SecondSuccessor()->block_id(); | |
| 1239 } | |
| 1240 }; | 1260 }; |
| 1241 | 1261 |
| 1242 | 1262 |
| 1243 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1263 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
| 1244 public: | 1264 public: |
| 1245 explicit LFixedArrayBaseLength(LOperand* value) { | 1265 explicit LFixedArrayBaseLength(LOperand* value) { |
| 1246 inputs_[0] = value; | 1266 inputs_[0] = value; |
| 1247 } | 1267 } |
| 1248 | 1268 |
| 1249 LOperand* value() { return inputs_[0]; } | 1269 LOperand* value() { return inputs_[0]; } |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 | 2387 |
| 2368 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { | 2388 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 2369 public: | 2389 public: |
| 2370 explicit LCheckNonSmi(LOperand* value) { | 2390 explicit LCheckNonSmi(LOperand* value) { |
| 2371 inputs_[0] = value; | 2391 inputs_[0] = value; |
| 2372 } | 2392 } |
| 2373 | 2393 |
| 2374 LOperand* value() { return inputs_[0]; } | 2394 LOperand* value() { return inputs_[0]; } |
| 2375 | 2395 |
| 2376 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2396 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2397 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
| 2377 }; | 2398 }; |
| 2378 | 2399 |
| 2379 | 2400 |
| 2380 class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { | 2401 class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { |
| 2381 public: | 2402 public: |
| 2382 LClampDToUint8(LOperand* unclamped, LOperand* temp) { | 2403 LClampDToUint8(LOperand* unclamped, LOperand* temp) { |
| 2383 inputs_[0] = unclamped; | 2404 inputs_[0] = unclamped; |
| 2384 temps_[0] = temp; | 2405 temps_[0] = temp; |
| 2385 } | 2406 } |
| 2386 | 2407 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2410 temps_[0] = temp; | 2431 temps_[0] = temp; |
| 2411 } | 2432 } |
| 2412 | 2433 |
| 2413 LOperand* unclamped() { return inputs_[0]; } | 2434 LOperand* unclamped() { return inputs_[0]; } |
| 2414 LOperand* temp() { return temps_[0]; } | 2435 LOperand* temp() { return temps_[0]; } |
| 2415 | 2436 |
| 2416 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") | 2437 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") |
| 2417 }; | 2438 }; |
| 2418 | 2439 |
| 2419 | 2440 |
| 2441 class LAllocateObject: public LTemplateInstruction<1, 1, 2> { |
| 2442 public: |
| 2443 LAllocateObject(LOperand* temp, LOperand* temp2) { |
| 2444 temps_[0] = temp; |
| 2445 temps_[1] = temp2; |
| 2446 } |
| 2447 |
| 2448 LOperand* temp() { return temps_[0]; } |
| 2449 LOperand* temp2() { return temps_[1]; } |
| 2450 |
| 2451 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") |
| 2452 DECLARE_HYDROGEN_ACCESSOR(AllocateObject) |
| 2453 }; |
| 2454 |
| 2455 |
| 2420 class LAllocate: public LTemplateInstruction<1, 2, 2> { | 2456 class LAllocate: public LTemplateInstruction<1, 2, 2> { |
| 2421 public: | 2457 public: |
| 2422 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) { | 2458 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) { |
| 2423 inputs_[1] = size; | 2459 inputs_[1] = size; |
| 2424 temps_[0] = temp1; | 2460 temps_[0] = temp1; |
| 2425 temps_[1] = temp2; | 2461 temps_[1] = temp2; |
| 2426 } | 2462 } |
| 2427 | 2463 |
| 2428 LOperand* size() { return inputs_[1]; } | 2464 LOperand* size() { return inputs_[1]; } |
| 2429 LOperand* temp1() { return temps_[0]; } | 2465 LOperand* temp1() { return temps_[0]; } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 | 2548 |
| 2513 LOperand* object() { return inputs_[0]; } | 2549 LOperand* object() { return inputs_[0]; } |
| 2514 LOperand* key() { return inputs_[1]; } | 2550 LOperand* key() { return inputs_[1]; } |
| 2515 | 2551 |
| 2516 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") | 2552 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
| 2517 }; | 2553 }; |
| 2518 | 2554 |
| 2519 | 2555 |
| 2520 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { | 2556 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
| 2521 public: | 2557 public: |
| 2522 LOsrEntry(); | 2558 LOsrEntry() {} |
| 2523 | 2559 |
| 2524 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 2560 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
| 2525 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") | 2561 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2526 | |
| 2527 LOperand** SpilledRegisterArray() { return register_spills_; } | |
| 2528 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } | |
| 2529 | |
| 2530 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); | |
| 2531 void MarkSpilledDoubleRegister(int allocation_index, | |
| 2532 LOperand* spill_operand); | |
| 2533 | |
| 2534 private: | |
| 2535 // Arrays of spill slot operands for registers with an assigned spill | |
| 2536 // slot, i.e., that must also be restored to the spill slot on OSR entry. | |
| 2537 // NULL if the register has no assigned spill slot. Indexed by allocation | |
| 2538 // index. | |
| 2539 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters]; | |
| 2540 LOperand* double_register_spills_[ | |
| 2541 DoubleRegister::kMaxNumAllocatableRegisters]; | |
| 2542 }; | 2562 }; |
| 2543 | 2563 |
| 2544 | 2564 |
| 2545 class LStackCheck: public LTemplateInstruction<0, 0, 0> { | 2565 class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
| 2546 public: | 2566 public: |
| 2547 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | 2567 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
| 2548 DECLARE_HYDROGEN_ACCESSOR(StackCheck) | 2568 DECLARE_HYDROGEN_ACCESSOR(StackCheck) |
| 2549 | 2569 |
| 2550 Label* done_label() { return &done_label_; } | 2570 Label* done_label() { return &done_label_; } |
| 2551 | 2571 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2804 | 2824 |
| 2805 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2825 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2806 }; | 2826 }; |
| 2807 | 2827 |
| 2808 #undef DECLARE_HYDROGEN_ACCESSOR | 2828 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2809 #undef DECLARE_CONCRETE_INSTRUCTION | 2829 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2810 | 2830 |
| 2811 } } // namespace v8::internal | 2831 } } // namespace v8::internal |
| 2812 | 2832 |
| 2813 #endif // V8_MIPS_LITHIUM_MIPS_H_ | 2833 #endif // V8_MIPS_LITHIUM_MIPS_H_ |
| OLD | NEW |