OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 #include "src/parsing/parser.h" | 7 #include "src/parsing/parser.h" |
8 #include "src/zone.h" | 8 #include "src/zone.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, | 24 static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, |
25 "dummy", 0, 0, 0, 0, 0, 0); | 25 "dummy", 0, 0, 0, 0, 0, 0); |
26 | 26 |
27 // So we can get a real JS function. | 27 // So we can get a real JS function. |
28 static Handle<JSFunction> Compile(const char* source) { | 28 static Handle<JSFunction> Compile(const char* source) { |
29 Isolate* isolate = CcTest::i_isolate(); | 29 Isolate* isolate = CcTest::i_isolate(); |
30 Handle<String> source_code = isolate->factory() | 30 Handle<String> source_code = isolate->factory() |
31 ->NewStringFromUtf8(CStrVector(source)) | 31 ->NewStringFromUtf8(CStrVector(source)) |
32 .ToHandleChecked(); | 32 .ToHandleChecked(); |
33 Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript( | 33 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( |
34 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), | 34 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), |
35 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, | 35 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, |
36 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); | 36 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); |
37 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 37 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
38 shared_function, isolate->native_context()); | 38 shared, isolate->native_context()); |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 TEST(TestLinkageCreate) { | 42 TEST(TestLinkageCreate) { |
43 HandleAndZoneScope handles; | 43 HandleAndZoneScope handles; |
44 Handle<JSFunction> function = Compile("a + b"); | 44 Handle<JSFunction> function = Compile("a + b"); |
45 ParseInfo parse_info(handles.main_zone(), function); | 45 ParseInfo parse_info(handles.main_zone(), function); |
46 CompilationInfo info(&parse_info); | 46 CompilationInfo info(&parse_info); |
47 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); | 47 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); |
48 CHECK(descriptor); | 48 CHECK(descriptor); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount())); | 108 CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount())); |
109 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); | 109 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); |
110 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); | 110 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); |
111 CHECK_EQ(false, descriptor->IsJSFunctionCall()); | 111 CHECK_EQ(false, descriptor->IsJSFunctionCall()); |
112 // TODO(titzer): test linkage creation for outgoing stub calls. | 112 // TODO(titzer): test linkage creation for outgoing stub calls. |
113 } | 113 } |
114 | 114 |
115 } // namespace compiler | 115 } // namespace compiler |
116 } // namespace internal | 116 } // namespace internal |
117 } // namespace v8 | 117 } // namespace v8 |
OLD | NEW |