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" |
11 #include "src/factory.h" | 11 #include "src/factory.h" |
12 #include "src/gdb-jit.h" | 12 #include "src/gdb-jit.h" |
13 #include "src/ic/handler-compiler.h" | 13 #include "src/ic/handler-compiler.h" |
14 #include "src/ic/ic.h" | 14 #include "src/ic/ic.h" |
15 #include "src/macro-assembler.h" | 15 #include "src/macro-assembler.h" |
| 16 #include "src/parser.h" |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 | 21 |
21 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub) | 22 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub) |
22 : call_descriptor_(stub->GetCallInterfaceDescriptor()), | 23 : call_descriptor_(stub->GetCallInterfaceDescriptor()), |
23 stack_parameter_count_(no_reg), | 24 stack_parameter_count_(no_reg), |
24 hint_stack_parameter_count_(-1), | 25 hint_stack_parameter_count_(-1), |
25 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 26 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 state.RemoveAll(); | 447 state.RemoveAll(); |
447 state.Add(GENERIC); | 448 state.Add(GENERIC); |
448 } else { | 449 } else { |
449 state.Add(MONOMORPHIC_MAP); | 450 state.Add(MONOMORPHIC_MAP); |
450 } | 451 } |
451 TraceTransition(old_state, state); | 452 TraceTransition(old_state, state); |
452 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); | 453 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); |
453 } | 454 } |
454 | 455 |
455 | 456 |
| 457 namespace { |
| 458 |
| 459 Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) { |
| 460 v8::ExtensionConfiguration no_extensions; |
| 461 Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment( |
| 462 MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(), |
| 463 &no_extensions); |
| 464 Handle<JSBuiltinsObject> builtins = handle(ctx->builtins()); |
| 465 MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, name); |
| 466 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked()); |
| 467 DCHECK(!function->IsUndefined() && |
| 468 "JavaScript implementation of stub not found"); |
| 469 // Just to make sure nobody calls this... |
| 470 function->set_code(isolate->builtins()->builtin(Builtins::kIllegal)); |
| 471 return function; |
| 472 } |
| 473 } // namespace |
| 474 |
| 475 |
| 476 Handle<Code> TurboFanCodeStub::GenerateCode() { |
| 477 Zone zone; |
| 478 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair. |
| 479 ParseInfo parse_info(&zone, GetFunction(isolate(), GetFunctionName())); |
| 480 CompilationInfo info(&parse_info); |
| 481 info.SetStub(this); |
| 482 return info.GenerateCodeStub(); |
| 483 } |
| 484 |
| 485 |
456 template<class StateType> | 486 template<class StateType> |
457 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { | 487 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
458 // Note: Although a no-op transition is semantically OK, it is hinting at a | 488 // Note: Although a no-op transition is semantically OK, it is hinting at a |
459 // bug somewhere in our state transition machinery. | 489 // bug somewhere in our state transition machinery. |
460 DCHECK(from != to); | 490 DCHECK(from != to); |
461 if (!FLAG_trace_ic) return; | 491 if (!FLAG_trace_ic) return; |
462 OFStream os(stdout); | 492 OFStream os(stdout); |
463 os << "["; | 493 os << "["; |
464 PrintBaseName(os); | 494 PrintBaseName(os); |
465 os << ": " << from << "=>" << to << "]" << std::endl; | 495 os << ": " << from << "=>" << to << "]" << std::endl; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 1025 } |
996 | 1026 |
997 | 1027 |
998 InternalArrayConstructorStub::InternalArrayConstructorStub( | 1028 InternalArrayConstructorStub::InternalArrayConstructorStub( |
999 Isolate* isolate) : PlatformCodeStub(isolate) { | 1029 Isolate* isolate) : PlatformCodeStub(isolate) { |
1000 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1030 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
1001 } | 1031 } |
1002 | 1032 |
1003 | 1033 |
1004 } } // namespace v8::internal | 1034 } } // namespace v8::internal |
OLD | NEW |