| 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/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) { | 470 Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) { |
| 471 v8::ExtensionConfiguration no_extensions; | 471 v8::ExtensionConfiguration no_extensions; |
| 472 Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment( | 472 Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment( |
| 473 MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(), | 473 MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(), |
| 474 &no_extensions); | 474 &no_extensions); |
| 475 Handle<JSBuiltinsObject> builtins = handle(ctx->builtins()); | 475 Handle<JSBuiltinsObject> builtins = handle(ctx->builtins()); |
| 476 MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, name); | 476 MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, name); |
| 477 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked()); | 477 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked()); |
| 478 DCHECK(!function->IsUndefined() && | 478 DCHECK(!function->IsUndefined() && |
| 479 "JavaScript implementation of stub not found"); | 479 "JavaScript implementation of stub not found"); |
| 480 // Just to make sure nobody calls this... | |
| 481 function->set_code(isolate->builtins()->builtin(Builtins::kIllegal)); | |
| 482 return function; | 480 return function; |
| 483 } | 481 } |
| 484 } // namespace | 482 } // namespace |
| 485 | 483 |
| 486 | 484 |
| 487 Handle<Code> TurboFanCodeStub::GenerateCode() { | 485 Handle<Code> TurboFanCodeStub::GenerateCode() { |
| 486 // Get the outer ("stub generator") function. |
| 487 const char* name = CodeStub::MajorName(MajorKey(), false); |
| 488 Handle<JSFunction> outer = GetFunction(isolate(), name); |
| 489 DCHECK_EQ(2, outer->shared()->length()); |
| 490 |
| 491 // Invoke the outer function to get the stub itself. |
| 492 Factory* factory = isolate()->factory(); |
| 493 Handle<Object> call_conv = factory->InternalizeUtf8String(name); |
| 494 Handle<Object> minor_key = factory->NewNumber(MinorKey()); |
| 495 Handle<Object> args[] = {call_conv, minor_key}; |
| 496 MaybeHandle<Object> result = Execution::Call( |
| 497 isolate(), outer, factory->undefined_value(), 2, args, false); |
| 498 Handle<JSFunction> inner = Handle<JSFunction>::cast(result.ToHandleChecked()); |
| 499 // Just to make sure nobody calls this... |
| 500 inner->set_code(isolate()->builtins()->builtin(Builtins::kIllegal)); |
| 501 |
| 488 Zone zone; | 502 Zone zone; |
| 489 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair. | 503 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair. |
| 490 ParseInfo parse_info(&zone, GetFunction(isolate(), GetFunctionName())); | 504 ParseInfo parse_info(&zone, inner); |
| 491 CompilationInfo info(&parse_info); | 505 CompilationInfo info(&parse_info); |
| 492 info.SetStub(this); | 506 info.SetStub(this); |
| 493 return info.GenerateCodeStub(); | 507 return info.GenerateCodeStub(); |
| 494 } | 508 } |
| 495 | 509 |
| 496 | 510 |
| 497 template<class StateType> | 511 template<class StateType> |
| 498 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { | 512 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
| 499 // Note: Although a no-op transition is semantically OK, it is hinting at a | 513 // Note: Although a no-op transition is semantically OK, it is hinting at a |
| 500 // bug somewhere in our state transition machinery. | 514 // bug somewhere in our state transition machinery. |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 } | 1039 } |
| 1026 | 1040 |
| 1027 | 1041 |
| 1028 InternalArrayConstructorStub::InternalArrayConstructorStub( | 1042 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 1029 Isolate* isolate) : PlatformCodeStub(isolate) { | 1043 Isolate* isolate) : PlatformCodeStub(isolate) { |
| 1030 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1044 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 1031 } | 1045 } |
| 1032 | 1046 |
| 1033 | 1047 |
| 1034 } } // namespace v8::internal | 1048 } } // namespace v8::internal |
| OLD | NEW |