diff options
Diffstat (limited to 'deps/v8/src/fast-accessor-assembler.h')
-rw-r--r-- | deps/v8/src/fast-accessor-assembler.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/deps/v8/src/fast-accessor-assembler.h b/deps/v8/src/fast-accessor-assembler.h index 57e72e8eb1..9468d8603a 100644 --- a/deps/v8/src/fast-accessor-assembler.h +++ b/deps/v8/src/fast-accessor-assembler.h @@ -6,15 +6,15 @@ #define V8_FAST_ACCESSOR_ASSEMBLER_H_ #include <stdint.h> +#include <memory> #include <vector> #include "include/v8-experimental.h" #include "src/base/macros.h" -#include "src/base/smart-pointers.h" #include "src/handles.h" // For CodeStubAssembler::Label. (We cannot forward-declare inner classes.) -#include "src/compiler/code-stub-assembler.h" +#include "src/code-stub-assembler.h" namespace v8 { namespace internal { @@ -54,15 +54,28 @@ class FastAccessorAssembler { ValueId IntegerConstant(int int_constant); ValueId GetReceiver(); ValueId LoadInternalField(ValueId value_id, int field_no); + + // Loads internal field and assumes the object is indeed a valid API object + // with the proper internal fields present. + // The intended use is to call this on an object whose structure has already + // been checked previously, e.g. the accessor's receiver, which is map-checked + // before the fast accessor is called on it. Using this on an arbitrary object + // will result in unsafe memory accesses. + ValueId LoadInternalFieldUnchecked(ValueId value_id, int field_no); + ValueId LoadValue(ValueId value_id, int offset); ValueId LoadObject(ValueId value_id, int offset); + // Converts a machine integer to a SMI. + ValueId ToSmi(ValueId value_id); + // Builder / assembler functions for control flow. void ReturnValue(ValueId value_id); void CheckFlagSetOrReturnNull(ValueId value_id, int mask); void CheckNotZeroOrReturnNull(ValueId value_id); LabelId MakeLabel(); void SetLabel(LabelId label_id); + void Goto(LabelId label_id); void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); // C++ callback. @@ -73,9 +86,11 @@ class FastAccessorAssembler { private: ValueId FromRaw(compiler::Node* node); - LabelId FromRaw(compiler::CodeStubAssembler::Label* label); + LabelId FromRaw(CodeStubAssembler::Label* label); compiler::Node* FromId(ValueId value) const; - compiler::CodeStubAssembler::Label* FromId(LabelId value) const; + CodeStubAssembler::Label* FromId(LabelId value) const; + + void CheckIsJSObjectOrJump(ValueId value, LabelId label_id); void Clear(); Zone* zone() { return &zone_; } @@ -83,13 +98,13 @@ class FastAccessorAssembler { Zone zone_; Isolate* isolate_; - base::SmartPointer<compiler::CodeStubAssembler> assembler_; + std::unique_ptr<CodeStubAssembler> assembler_; // To prevent exposing the RMA internals to the outside world, we'll map // Node + Label pointers integers wrapped in ValueId and LabelId instances. // These vectors maintain this mapping. std::vector<compiler::Node*> nodes_; - std::vector<compiler::CodeStubAssembler::Label*> labels_; + std::vector<CodeStubAssembler::Label*> labels_; // Remember the current state for easy error checking. (We prefer to be // strict as this class will be exposed at the API.) |