Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: runtime/vm/deopt_instructions.h

Issue 10825236: Replace deopt stubs location/register shuffling with using deopt-info. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DEOPT_INSTRUCTIONS_H_ 5 #ifndef VM_DEOPT_INSTRUCTIONS_H_
6 #define VM_DEOPT_INSTRUCTIONS_H_ 6 #define VM_DEOPT_INSTRUCTIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h"
9 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
10 #include "vm/object.h" 11 #include "vm/object.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 class Location; 15 class Location;
15 class Value; 16 class Value;
16 17
18 // Holds all data relevant for execution of deoptimization instructions.
19 class DeoptimizationContext : public ValueObject {
20 public:
21 // 'frame_start' points to the return address just below the frame's
siva 2012/08/09 21:38:19 'frame_start' -> 'to_frame_start'
srdjan 2012/08/09 23:28:30 Done.
22 // stack pointer. 'num_args' is 0 if there are no arguments or if there
23 // are optional arguments.
24 explicit DeoptimizationContext(intptr_t* to_frame_start,
25 const Array& object_table,
26 intptr_t num_args);
siva 2012/08/09 21:38:19 why explicit?
srdjan 2012/08/09 23:28:30 Removed
27
28 intptr_t* GetFromFrameAddressAt(intptr_t index) const {
29 ASSERT((0 <= index) && (index < from_frame_size_));
30 return &from_frame_[index];
31 }
32
33 intptr_t* GetToFrameAddressAt(intptr_t index) const {
34 ASSERT(0 <= index);
siva 2012/08/09 21:38:19 Is there a way to assert that index is valid on th
srdjan 2012/08/09 23:28:30 Passing additional to_frame_size and checking it h
35 return &to_frame_[index];
36 }
37
38 intptr_t* GetFromFpAddress() const;
39 intptr_t* GetFromPcAddress() const;
40
41 RawObject* ObjectAt(intptr_t index) const {
42 return object_table_.At(index);
43 }
44
45 intptr_t RegisterValue(Register reg) const {
46 return registers_copy_[reg];
47 }
48
49 intptr_t from_frame_size() const { return from_frame_size_; }
50
51 private:
52 const Array& object_table_;
53 intptr_t* to_frame_;
54 intptr_t* from_frame_;
55 intptr_t from_frame_size_;
56 intptr_t* registers_copy_;
57 const intptr_t num_args_;
58
59 DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext);
60 };
61
62
63
17 // Represents one deopt instruction, e.g, setup return address, store object, 64 // Represents one deopt instruction, e.g, setup return address, store object,
18 // store register, etc. The target is defined by instruction's position in 65 // store register, etc. The target is defined by instruction's position in
19 // the deopt-info array. 66 // the deopt-info array.
20 class DeoptInstr : public ZoneAllocated { 67 class DeoptInstr : public ZoneAllocated {
21 public: 68 public:
22 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index); 69 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index);
23 70
71 DeoptInstr() {}
72 virtual ~DeoptInstr() {}
73
24 virtual const char* ToCString() const = 0; 74 virtual const char* ToCString() const = 0;
25 75
76 virtual void Execute(DeoptimizationContext* deopt_context,
77 intptr_t to_index) = 0;
78
26 protected: 79 protected:
27 enum Kind { 80 enum Kind {
28 kSetRetAddress, 81 kSetRetAddress,
29 kCopyConstant, 82 kCopyConstant,
30 kCopyRegister, 83 kCopyRegister,
31 kCopyStackSlot, 84 kCopyStackSlot,
32 kSetPcMarker, 85 kSetPcMarker,
33 kSetCallerFp, 86 kSetCallerFp,
34 kSetCallerPc, 87 kSetCallerPc,
35 }; 88 };
36 89
37 DeoptInstr() {}
38
39 virtual DeoptInstr::Kind kind() const = 0; 90 virtual DeoptInstr::Kind kind() const = 0;
40 virtual intptr_t from_index() const = 0; 91 virtual intptr_t from_index() const = 0;
41 92
42 friend class DeoptInfoBuilder; 93 friend class DeoptInfoBuilder;
43 94
44 private: 95 private:
45 DISALLOW_COPY_AND_ASSIGN(DeoptInstr); 96 DISALLOW_COPY_AND_ASSIGN(DeoptInstr);
46 }; 97 };
47 98
48 99
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const GrowableObjectArray& object_table_; 132 const GrowableObjectArray& object_table_;
82 const intptr_t num_args_; 133 const intptr_t num_args_;
83 134
84 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder); 135 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder);
85 }; 136 };
86 137
87 } // namespace dart 138 } // namespace dart
88 139
89 #endif // VM_DEOPT_INSTRUCTIONS_H_ 140 #endif // VM_DEOPT_INSTRUCTIONS_H_
90 141
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698