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

Unified Diff: test/cctest/compiler/test-run-stubs.cc

Issue 1010673004: Tweak the TurboFan pipeline for stub compilation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed feedback Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-stubs.cc
diff --git a/test/cctest/compiler/test-run-stubs.cc b/test/cctest/compiler/test-run-stubs.cc
index 0e575710013151c125a300ba7b745f6afbe9e8f1..67c08b08d6452ae13eaff3d32e8cd5d48fcf3597 100644
--- a/test/cctest/compiler/test-run-stubs.cc
+++ b/test/cctest/compiler/test-run-stubs.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "src/bootstrapper.h"
#include "src/code-stubs.h"
+#include "src/compiler/common-operator.h"
#include "src/compiler/graph.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
-#include "src/compiler/raw-machine-assembler.h"
-#include "src/globals.h"
-#include "src/handles.h"
+#include "src/parser.h"
#include "test/cctest/compiler/function-tester.h"
#if V8_TURBOFAN_TARGET
@@ -17,6 +17,20 @@ using namespace v8::internal;
using namespace v8::internal::compiler;
+static Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) {
+ v8::ExtensionConfiguration no_extensions;
+ Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment(
+ MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(),
+ &no_extensions);
+ Handle<JSBuiltinsObject> builtins = handle(ctx->builtins());
+ MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, name);
+ Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked());
+ // Just to make sure nobody calls this...
+ function->set_code(isolate->builtins()->builtin(Builtins::kIllegal));
+ return function;
+}
+
+
class StringLengthStubTF : public CodeStub {
public:
explicit StringLengthStubTF(Isolate* isolate) : CodeStub(isolate) {}
@@ -28,18 +42,13 @@ class StringLengthStubTF : public CodeStub {
};
Handle<Code> GenerateCode() OVERRIDE {
- CompilationInfoWithZone info(this, isolate());
- Graph graph(info.zone());
- CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
- RawMachineAssembler m(isolate(), &graph, descriptor->GetMachineSignature());
-
- Node* str = m.Load(kMachAnyTagged, m.Parameter(0),
- m.Int32Constant(JSValue::kValueOffset - kHeapObjectTag));
- Node* len = m.Load(kMachAnyTagged, str,
- m.Int32Constant(String::kLengthOffset - kHeapObjectTag));
- m.Return(len);
-
- return Pipeline::GenerateCodeForTesting(&info, &graph, m.Export());
+ // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
+ CompilationInfoWithZone info(GetFunction(isolate(), "STRING_LENGTH_STUB"));
+ info.SetStub(this);
+ // Run a "mini pipeline", extracted from compiler.cc.
+ CHECK(Parser::ParseStatic(info.parse_info()));
+ CHECK(Compiler::Analyze(info.parse_info()));
+ return Pipeline(&info).GenerateCode();
}
Major MajorKey() const OVERRIDE { return StringLength; };
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698