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

Side by Side Diff: src/code-stubs.cc

Issue 1137703002: Add a MathFloor stub generated with TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment Created 5 years, 7 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
OLDNEW
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/compiler/pipeline.h"
10 #include "src/cpu-profiler.h" 11 #include "src/cpu-profiler.h"
11 #include "src/factory.h" 12 #include "src/factory.h"
12 #include "src/gdb-jit.h" 13 #include "src/gdb-jit.h"
13 #include "src/ic/handler-compiler.h" 14 #include "src/ic/handler-compiler.h"
14 #include "src/ic/ic.h" 15 #include "src/ic/ic.h"
15 #include "src/macro-assembler.h" 16 #include "src/macro-assembler.h"
17 #include "src/parser.h"
18
19 using namespace v8::internal::compiler;
16 20
17 namespace v8 { 21 namespace v8 {
18 namespace internal { 22 namespace internal {
19 23
20 24
21 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub) 25 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub)
22 : call_descriptor_(stub->GetCallInterfaceDescriptor()), 26 : call_descriptor_(stub->GetCallInterfaceDescriptor()),
23 stack_parameter_count_(no_reg), 27 stack_parameter_count_(no_reg),
24 hint_stack_parameter_count_(-1), 28 hint_stack_parameter_count_(-1),
25 function_mode_(NOT_JS_FUNCTION_STUB_MODE), 29 function_mode_(NOT_JS_FUNCTION_STUB_MODE),
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 state.RemoveAll(); 450 state.RemoveAll();
447 state.Add(GENERIC); 451 state.Add(GENERIC);
448 } else { 452 } else {
449 state.Add(MONOMORPHIC_MAP); 453 state.Add(MONOMORPHIC_MAP);
450 } 454 }
451 TraceTransition(old_state, state); 455 TraceTransition(old_state, state);
452 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral())); 456 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral()));
453 } 457 }
454 458
455 459
460 namespace {
461
462 static Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) {
Benedikt Meurer 2015/05/08 12:17:07 Nit: no static inside anonymous namespace.
danno 2015/05/08 15:28:01 Done.
463 v8::ExtensionConfiguration no_extensions;
464 Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment(
465 MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(),
466 &no_extensions);
467 Handle<JSBuiltinsObject> builtins = handle(ctx->builtins());
468 MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, name);
469 Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked());
470 DCHECK(!function->IsUndefined() &&
471 "JavaScript implementation of stub not found");
472 // Just to make sure nobody calls this...
473 function->set_code(isolate->builtins()->builtin(Builtins::kIllegal));
474 return function;
475 }
476 };
Benedikt Meurer 2015/05/08 12:17:07 Remove ; and add empty line before, plus add // na
danno 2015/05/08 15:28:01 Done.
477
478
479 Handle<Code> TurboFanCodeStub::GenerateCode() {
480 Zone zone;
481 // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
482 ParseInfo parse_info(&zone, GetFunction(isolate(), GetFunctionName()));
483 CompilationInfo info(&parse_info);
484 info.SetStub(this);
485 // Run a "mini pipeline", extracted from compiler.cc.
486 CHECK(Parser::ParseStatic(info.parse_info()));
487 CHECK(Compiler::Analyze(info.parse_info()));
488 return Pipeline(&info).GenerateCode();
489 }
490
491
456 template<class StateType> 492 template<class StateType>
457 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { 493 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
458 // Note: Although a no-op transition is semantically OK, it is hinting at a 494 // Note: Although a no-op transition is semantically OK, it is hinting at a
459 // bug somewhere in our state transition machinery. 495 // bug somewhere in our state transition machinery.
460 DCHECK(from != to); 496 DCHECK(from != to);
461 if (!FLAG_trace_ic) return; 497 if (!FLAG_trace_ic) return;
462 OFStream os(stdout); 498 OFStream os(stdout);
463 os << "["; 499 os << "[";
464 PrintBaseName(os); 500 PrintBaseName(os);
465 os << ": " << from << "=>" << to << "]" << std::endl; 501 os << ": " << from << "=>" << to << "]" << std::endl;
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 1022 }
987 1023
988 1024
989 InternalArrayConstructorStub::InternalArrayConstructorStub( 1025 InternalArrayConstructorStub::InternalArrayConstructorStub(
990 Isolate* isolate) : PlatformCodeStub(isolate) { 1026 Isolate* isolate) : PlatformCodeStub(isolate) {
991 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1027 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
992 } 1028 }
993 1029
994 1030
995 } } // namespace v8::internal 1031 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler.h » ('j') | src/compiler/access-builder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698