| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ |
| 6 #define V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ | 6 #define V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // - After creating the instance, you can call an arbitrary sequence of | 41 // - After creating the instance, you can call an arbitrary sequence of |
| 42 // builder functions to build the desired function. | 42 // builder functions to build the desired function. |
| 43 // - When done, you can Build() the accessor and query for the build results. | 43 // - When done, you can Build() the accessor and query for the build results. |
| 44 // | 44 // |
| 45 // You cannot call any result getters before Build() was called & successful; | 45 // You cannot call any result getters before Build() was called & successful; |
| 46 // and you cannot call any builder functions after Build() was called. | 46 // and you cannot call any builder functions after Build() was called. |
| 47 class FastAccessorAssembler { | 47 class FastAccessorAssembler { |
| 48 public: | 48 public: |
| 49 typedef v8::experimental::FastAccessorBuilder::ValueId ValueId; | 49 typedef v8::experimental::FastAccessorBuilder::ValueId ValueId; |
| 50 typedef v8::experimental::FastAccessorBuilder::LabelId LabelId; | 50 typedef v8::experimental::FastAccessorBuilder::LabelId LabelId; |
| 51 typedef v8::FunctionCallback FunctionCallback; |
| 51 | 52 |
| 52 explicit FastAccessorAssembler(Isolate* isolate); | 53 explicit FastAccessorAssembler(Isolate* isolate); |
| 53 ~FastAccessorAssembler(); | 54 ~FastAccessorAssembler(); |
| 54 | 55 |
| 55 // Builder / assembler functions: | 56 // Builder / assembler functions: |
| 56 ValueId IntegerConstant(int int_constant); | 57 ValueId IntegerConstant(int int_constant); |
| 57 ValueId GetReceiver(); | 58 ValueId GetReceiver(); |
| 58 ValueId LoadInternalField(ValueId value_id, int field_no); | 59 ValueId LoadInternalField(ValueId value_id, int field_no); |
| 59 ValueId LoadValue(ValueId value_id, int offset); | 60 ValueId LoadValue(ValueId value_id, int offset); |
| 60 ValueId LoadObject(ValueId value_id, int offset); | 61 ValueId LoadObject(ValueId value_id, int offset); |
| 61 | 62 |
| 62 // Builder / assembler functions for control flow. | 63 // Builder / assembler functions for control flow. |
| 63 void ReturnValue(ValueId value_id); | 64 void ReturnValue(ValueId value_id); |
| 64 void CheckFlagSetOrReturnNull(ValueId value_id, int mask); | 65 void CheckFlagSetOrReturnNull(ValueId value_id, int mask); |
| 65 void CheckNotZeroOrReturnNull(ValueId value_id); | 66 void CheckNotZeroOrReturnNull(ValueId value_id); |
| 66 | |
| 67 // TODO(vogelheim): Implement a C++ callback. | |
| 68 // void CheckNotNullOrCallback(ValueId value_id, ..c++-callback type..., | |
| 69 // ValueId arg1, ValueId arg2, ...); | |
| 70 | |
| 71 LabelId MakeLabel(); | 67 LabelId MakeLabel(); |
| 72 void SetLabel(LabelId label_id); | 68 void SetLabel(LabelId label_id); |
| 73 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); | 69 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); |
| 74 | 70 |
| 71 // C++ callback. |
| 72 ValueId Call(FunctionCallback callback, ValueId arg); |
| 73 |
| 75 // Assemble the code. | 74 // Assemble the code. |
| 76 MaybeHandle<Code> Build(); | 75 MaybeHandle<Code> Build(); |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 ValueId FromRaw(Node* node); | 78 ValueId FromRaw(Node* node); |
| 80 LabelId FromRaw(RawMachineLabel* label); | 79 LabelId FromRaw(RawMachineLabel* label); |
| 81 Node* FromId(ValueId value) const; | 80 Node* FromId(ValueId value) const; |
| 82 RawMachineLabel* FromId(LabelId value) const; | 81 RawMachineLabel* FromId(LabelId value) const; |
| 83 | 82 |
| 84 Zone* zone() { return &zone_; } | 83 Zone* zone() { return &zone_; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 enum { kBuilding, kBuilt, kError } state_; | 96 enum { kBuilding, kBuilt, kError } state_; |
| 98 | 97 |
| 99 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler); | 98 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler); |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 } // namespace compiler | 101 } // namespace compiler |
| 103 } // namespace internal | 102 } // namespace internal |
| 104 } // namespace v8 | 103 } // namespace v8 |
| 105 | 104 |
| 106 #endif // V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ | 105 #endif // V8_COMPILER_FAST_ACCESSOR_ASSEMBLER_H_ |
| OLD | NEW |