OLD | NEW |
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 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 static const int kNumber = 0; | 544 static const int kNumber = 0; |
545 | 545 |
546 DEFINE_CALL_INTERFACE_DESCRIPTOR(NumberToString); | 546 DEFINE_CALL_INTERFACE_DESCRIPTOR(NumberToString); |
547 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); | 547 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); |
548 }; | 548 }; |
549 | 549 |
550 | 550 |
551 class FastNewClosureStub : public HydrogenCodeStub { | 551 class FastNewClosureStub : public HydrogenCodeStub { |
552 public: | 552 public: |
553 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, | 553 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, |
554 bool is_generator) | 554 FunctionKind kind) |
555 : HydrogenCodeStub(isolate) { | 555 : HydrogenCodeStub(isolate) { |
| 556 DCHECK(IsValidFunctionKind(kind)); |
556 set_sub_minor_key(StrictModeBits::encode(strict_mode) | | 557 set_sub_minor_key(StrictModeBits::encode(strict_mode) | |
557 IsGeneratorBits::encode(is_generator)); | 558 FunctionKindBits::encode(kind)); |
558 } | 559 } |
559 | 560 |
560 StrictMode strict_mode() const { | 561 StrictMode strict_mode() const { |
561 return StrictModeBits::decode(sub_minor_key()); | 562 return StrictModeBits::decode(sub_minor_key()); |
562 } | 563 } |
563 | 564 |
564 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } | 565 FunctionKind kind() const { |
| 566 return FunctionKindBits::decode(sub_minor_key()); |
| 567 } |
| 568 bool is_arrow() const { return IsArrowFunction(kind()); } |
| 569 bool is_generator() const { return IsGeneratorFunction(kind()); } |
| 570 bool is_concise_method() const { return IsConciseMethod(kind()); } |
565 | 571 |
566 private: | 572 private: |
567 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; | 573 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; |
568 class IsGeneratorBits : public BitField<bool, 1, 1> {}; | 574 class FunctionKindBits : public BitField<FunctionKind, 1, 3> {}; |
569 | 575 |
570 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure); | 576 DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure); |
571 DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub); | 577 DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub); |
572 }; | 578 }; |
573 | 579 |
574 | 580 |
575 class FastNewContextStub FINAL : public HydrogenCodeStub { | 581 class FastNewContextStub FINAL : public HydrogenCodeStub { |
576 public: | 582 public: |
577 static const int kMaximumSlots = 64; | 583 static const int kMaximumSlots = 64; |
578 | 584 |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 | 2332 |
2327 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2333 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2328 #undef DEFINE_PLATFORM_CODE_STUB | 2334 #undef DEFINE_PLATFORM_CODE_STUB |
2329 #undef DEFINE_HANDLER_CODE_STUB | 2335 #undef DEFINE_HANDLER_CODE_STUB |
2330 #undef DEFINE_HYDROGEN_CODE_STUB | 2336 #undef DEFINE_HYDROGEN_CODE_STUB |
2331 #undef DEFINE_CODE_STUB | 2337 #undef DEFINE_CODE_STUB |
2332 #undef DEFINE_CODE_STUB_BASE | 2338 #undef DEFINE_CODE_STUB_BASE |
2333 } } // namespace v8::internal | 2339 } } // namespace v8::internal |
2334 | 2340 |
2335 #endif // V8_CODE_STUBS_H_ | 2341 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |