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-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // So we can get a real JS function. | 28 // So we can get a real JS function. |
29 static Handle<JSFunction> Compile(const char* source) { | 29 static Handle<JSFunction> Compile(const char* source) { |
30 Isolate* isolate = CcTest::i_isolate(); | 30 Isolate* isolate = CcTest::i_isolate(); |
31 Handle<String> source_code = isolate->factory() | 31 Handle<String> source_code = isolate->factory() |
32 ->NewStringFromUtf8(CStrVector(source)) | 32 ->NewStringFromUtf8(CStrVector(source)) |
33 .ToHandleChecked(); | 33 .ToHandleChecked(); |
34 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( | 34 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( |
35 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), | 35 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), |
36 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, | 36 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, |
37 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); | 37 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE); |
38 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 38 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
39 shared, isolate->native_context()); | 39 shared, isolate->native_context()); |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 TEST(TestLinkageCreate) { | 43 TEST(TestLinkageCreate) { |
44 HandleAndZoneScope handles; | 44 HandleAndZoneScope handles; |
45 Handle<JSFunction> function = Compile("a + b"); | 45 Handle<JSFunction> function = Compile("a + b"); |
46 ParseInfo parse_info(handles.main_zone(), handle(function->shared())); | 46 ParseInfo parse_info(handles.main_zone(), handle(function->shared())); |
47 CompilationInfo info(&parse_info, function); | 47 CompilationInfo info(&parse_info, function); |
(...skipping 60 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 |