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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #endif | 92 #endif |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 Code::Kind CodeStub::GetCodeKind() const { | 96 Code::Kind CodeStub::GetCodeKind() const { |
97 return Code::STUB; | 97 return Code::STUB; |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 Code::Flags CodeStub::GetCodeFlags() const { | 101 Code::Flags CodeStub::GetCodeFlags() const { |
102 return Code::ComputeFlags(GetCodeKind(), GetICState(), GetExtraICState()); | 102 return Code::ComputeFlags(GetCodeKind(), GetExtraICState()); |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 Handle<Code> CodeStub::GetCodeCopy(const Code::FindAndReplacePattern& pattern) { | 106 Handle<Code> CodeStub::GetCodeCopy(const Code::FindAndReplacePattern& pattern) { |
107 Handle<Code> ic = GetCode(); | 107 Handle<Code> ic = GetCode(); |
108 ic = isolate()->factory()->CopyCode(ic); | 108 ic = isolate()->factory()->CopyCode(ic); |
109 ic->FindAndReplace(pattern); | 109 ic->FindAndReplace(pattern); |
110 RecordCodeGeneration(ic); | 110 RecordCodeGeneration(ic); |
111 return ic; | 111 return ic; |
112 } | 112 } |
(...skipping 14 matching lines...) Expand all Loading... |
127 // TODO(yangguo): remove this once we can serialize IC stubs. | 127 // TODO(yangguo): remove this once we can serialize IC stubs. |
128 masm.enable_serializer(); | 128 masm.enable_serializer(); |
129 NoCurrentFrameScope scope(&masm); | 129 NoCurrentFrameScope scope(&masm); |
130 Generate(&masm); | 130 Generate(&masm); |
131 } | 131 } |
132 | 132 |
133 // Create the code object. | 133 // Create the code object. |
134 CodeDesc desc; | 134 CodeDesc desc; |
135 masm.GetCode(&desc); | 135 masm.GetCode(&desc); |
136 // Copy the generated code into a heap object. | 136 // Copy the generated code into a heap object. |
137 Code::Flags flags = | 137 Code::Flags flags = Code::ComputeFlags(GetCodeKind(), GetExtraICState()); |
138 Code::ComputeFlags(GetCodeKind(), GetICState(), GetExtraICState()); | |
139 Handle<Code> new_object = factory->NewCode( | 138 Handle<Code> new_object = factory->NewCode( |
140 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 139 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
141 return new_object; | 140 return new_object; |
142 } | 141 } |
143 | 142 |
144 | 143 |
145 Handle<Code> CodeStub::GetCode() { | 144 Handle<Code> CodeStub::GetCode() { |
146 Heap* heap = isolate()->heap(); | 145 Heap* heap = isolate()->heap(); |
147 Code* code; | 146 Code* code; |
148 if (UseSpecialCache() ? FindCodeInSpecialCache(&code) | 147 if (UseSpecialCache() ? FindCodeInSpecialCache(&code) |
(...skipping 4595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4744 if (type->Is(Type::UntaggedPointer())) { | 4743 if (type->Is(Type::UntaggedPointer())) { |
4745 return Representation::External(); | 4744 return Representation::External(); |
4746 } | 4745 } |
4747 | 4746 |
4748 DCHECK(!type->Is(Type::Untagged())); | 4747 DCHECK(!type->Is(Type::Untagged())); |
4749 return Representation::Tagged(); | 4748 return Representation::Tagged(); |
4750 } | 4749 } |
4751 | 4750 |
4752 } // namespace internal | 4751 } // namespace internal |
4753 } // namespace v8 | 4752 } // namespace v8 |
OLD | NEW |