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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 static const int kInput = 2; | 1603 static const int kInput = 2; |
1604 | 1604 |
1605 private: | 1605 private: |
1606 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); | 1606 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); |
1607 }; | 1607 }; |
1608 | 1608 |
1609 | 1609 |
1610 class CallFunctionStub: public PlatformCodeStub { | 1610 class CallFunctionStub: public PlatformCodeStub { |
1611 public: | 1611 public: |
1612 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1612 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) |
1613 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { } | 1613 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { |
| 1614 ASSERT(argc <= Code::kMaxArguments); |
| 1615 } |
1614 | 1616 |
1615 void Generate(MacroAssembler* masm); | 1617 void Generate(MacroAssembler* masm); |
1616 | 1618 |
1617 static int ExtractArgcFromMinorKey(int minor_key) { | 1619 static int ExtractArgcFromMinorKey(int minor_key) { |
1618 return ArgcBits::decode(minor_key); | 1620 return ArgcBits::decode(minor_key); |
1619 } | 1621 } |
1620 | 1622 |
1621 private: | 1623 private: |
1622 int argc_; | 1624 int argc_; |
1623 CallFunctionFlags flags_; | 1625 CallFunctionFlags flags_; |
1624 | 1626 |
1625 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1627 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
1626 | 1628 |
1627 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1629 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
1628 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; | 1630 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; |
1629 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; | 1631 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; |
| 1632 |
| 1633 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
1630 | 1634 |
1631 Major MajorKey() const { return CallFunction; } | 1635 Major MajorKey() const { return CallFunction; } |
1632 int MinorKey() const { | 1636 int MinorKey() const { |
1633 // Encode the parameters in a unique 32 bit value. | 1637 // Encode the parameters in a unique 32 bit value. |
1634 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); | 1638 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
1635 } | 1639 } |
1636 | 1640 |
1637 bool CallAsMethod() { | 1641 bool CallAsMethod() { |
1638 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; | 1642 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; |
1639 } | 1643 } |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2523 | 2527 |
2524 | 2528 |
2525 class CallDescriptors { | 2529 class CallDescriptors { |
2526 public: | 2530 public: |
2527 static void InitializeForIsolate(Isolate* isolate); | 2531 static void InitializeForIsolate(Isolate* isolate); |
2528 }; | 2532 }; |
2529 | 2533 |
2530 } } // namespace v8::internal | 2534 } } // namespace v8::internal |
2531 | 2535 |
2532 #endif // V8_CODE_STUBS_H_ | 2536 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |