| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/parser.h" | 9 #include "src/parser.h" |
| 10 #include "src/zone.h" | 10 #include "src/zone.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 CHECK(descriptor); | 49 CHECK(descriptor); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 TEST(TestLinkageJSFunctionIncoming) { | 53 TEST(TestLinkageJSFunctionIncoming) { |
| 54 const char* sources[] = {"(function() { })", "(function(a) { })", | 54 const char* sources[] = {"(function() { })", "(function(a) { })", |
| 55 "(function(a,b) { })", "(function(a,b,c) { })"}; | 55 "(function(a,b) { })", "(function(a,b,c) { })"}; |
| 56 | 56 |
| 57 for (int i = 0; i < 3; i++) { | 57 for (int i = 0; i < 3; i++) { |
| 58 HandleAndZoneScope handles; | 58 HandleAndZoneScope handles; |
| 59 Handle<JSFunction> function = v8::Utils::OpenHandle( | 59 Handle<JSFunction> function = |
| 60 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i]))); | 60 Handle<JSFunction>::cast(v8::Utils::OpenHandle( |
| 61 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i])))); |
| 61 ParseInfo parse_info(handles.main_zone(), function); | 62 ParseInfo parse_info(handles.main_zone(), function); |
| 62 CompilationInfo info(&parse_info); | 63 CompilationInfo info(&parse_info); |
| 63 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); | 64 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); |
| 64 CHECK(descriptor); | 65 CHECK(descriptor); |
| 65 | 66 |
| 66 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount())); | 67 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount())); |
| 67 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); | 68 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); |
| 68 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); | 69 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); |
| 69 CHECK_EQ(true, descriptor->IsJSFunctionCall()); | 70 CHECK_EQ(true, descriptor->IsJSFunctionCall()); |
| 70 } | 71 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 | 106 |
| 106 TEST(TestLinkageRuntimeCall) { | 107 TEST(TestLinkageRuntimeCall) { |
| 107 // TODO(titzer): test linkage creation for outgoing runtime calls. | 108 // TODO(titzer): test linkage creation for outgoing runtime calls. |
| 108 } | 109 } |
| 109 | 110 |
| 110 | 111 |
| 111 TEST(TestLinkageStubCall) { | 112 TEST(TestLinkageStubCall) { |
| 112 // TODO(titzer): test linkage creation for outgoing stub calls. | 113 // TODO(titzer): test linkage creation for outgoing stub calls. |
| 113 } | 114 } |
| OLD | NEW |