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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 void CodeStub::InitializeDescriptor(Isolate* isolate, uint32_t key, | 241 void CodeStub::InitializeDescriptor(Isolate* isolate, uint32_t key, |
242 CodeStubDescriptor* desc) { | 242 CodeStubDescriptor* desc) { |
243 void** value_out = reinterpret_cast<void**>(desc); | 243 void** value_out = reinterpret_cast<void**>(desc); |
244 Dispatch(isolate, key, value_out, &InitializeDescriptorDispatchedCall); | 244 Dispatch(isolate, key, value_out, &InitializeDescriptorDispatchedCall); |
245 } | 245 } |
246 | 246 |
247 | 247 |
| 248 void CodeStub::GetCodeDispatchCall(CodeStub* stub, void** value_out) { |
| 249 Handle<Code>* code_out = reinterpret_cast<Handle<Code>*>(value_out); |
| 250 // Code stubs with special cache cannot be recreated from stub key. |
| 251 *code_out = stub->UseSpecialCache() ? Handle<Code>() : stub->GetCode(); |
| 252 } |
| 253 |
| 254 |
| 255 MaybeHandle<Code> CodeStub::GetCode(Isolate* isolate, uint32_t key) { |
| 256 HandleScope scope(isolate); |
| 257 Handle<Code> code; |
| 258 void** value_out = reinterpret_cast<void**>(&code); |
| 259 Dispatch(isolate, key, value_out, &GetCodeDispatchCall); |
| 260 return scope.CloseAndEscape(code); |
| 261 } |
| 262 |
| 263 |
248 // static | 264 // static |
249 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) { | 265 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) { |
250 // Generate the uninitialized versions of the stub. | 266 // Generate the uninitialized versions of the stub. |
251 for (int op = Token::BIT_OR; op <= Token::MOD; ++op) { | 267 for (int op = Token::BIT_OR; op <= Token::MOD; ++op) { |
252 for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) { | 268 for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) { |
253 BinaryOpICStub stub(isolate, | 269 BinaryOpICStub stub(isolate, |
254 static_cast<Token::Value>(op), | 270 static_cast<Token::Value>(op), |
255 static_cast<OverwriteMode>(mode)); | 271 static_cast<OverwriteMode>(mode)); |
256 stub.GetCode(); | 272 stub.GetCode(); |
257 } | 273 } |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 } | 946 } |
931 | 947 |
932 | 948 |
933 InternalArrayConstructorStub::InternalArrayConstructorStub( | 949 InternalArrayConstructorStub::InternalArrayConstructorStub( |
934 Isolate* isolate) : PlatformCodeStub(isolate) { | 950 Isolate* isolate) : PlatformCodeStub(isolate) { |
935 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 951 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
936 } | 952 } |
937 | 953 |
938 | 954 |
939 } } // namespace v8::internal | 955 } } // namespace v8::internal |
OLD | NEW |