Line data Source code
1 : // Copyright 2014 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_IC_ACCESS_COMPILER_H_
6 : #define V8_IC_ACCESS_COMPILER_H_
7 :
8 : #include "src/code-stubs.h"
9 : #include "src/ic/access-compiler-data.h"
10 : #include "src/macro-assembler.h"
11 : #include "src/objects.h"
12 :
13 : namespace v8 {
14 : namespace internal {
15 :
16 : class PropertyAccessCompiler BASE_EMBEDDED {
17 : public:
18 : enum Type { LOAD, STORE };
19 :
20 : static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name);
21 :
22 : protected:
23 245699 : PropertyAccessCompiler(Isolate* isolate, Type type)
24 245699 : : registers_(GetCallingConvention(isolate, type)),
25 : type_(type),
26 : isolate_(isolate),
27 245699 : masm_(isolate, nullptr, 256, CodeObjectRequired::kYes) {
28 : // TODO(yangguo): remove this once we can serialize IC stubs.
29 : masm_.enable_serializer();
30 245699 : }
31 :
32 : Type type() const { return type_; }
33 :
34 : MacroAssembler* masm() { return &masm_; }
35 : Isolate* isolate() const { return isolate_; }
36 245699 : Factory* factory() const { return isolate()->factory(); }
37 :
38 491398 : Register receiver() const { return registers_[0]; }
39 484358 : Register name() const { return registers_[1]; }
40 : Register slot() const;
41 : Register vector() const;
42 446964 : Register scratch1() const { return registers_[2]; }
43 390875 : Register scratch2() const { return registers_[3]; }
44 :
45 : Register* registers_;
46 :
47 : static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code);
48 :
49 : private:
50 : static Register* GetCallingConvention(Isolate* isolate, Type type);
51 : static void InitializePlatformSpecific(AccessCompilerData* data);
52 :
53 : Type type_;
54 : Isolate* isolate_;
55 : MacroAssembler masm_;
56 : // Ensure that MacroAssembler has a reasonable size.
57 : STATIC_ASSERT(sizeof(MacroAssembler) < 128 * kPointerSize);
58 : };
59 : } // namespace internal
60 : } // namespace v8
61 :
62 : #endif // V8_IC_ACCESS_COMPILER_H_
|