OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 snippets[i].code_snippet, kFunctionName); | 325 snippets[i].code_snippet, kFunctionName); |
326 | 326 |
327 BytecodeGraphTester tester(isolate, zone, script.start()); | 327 BytecodeGraphTester tester(isolate, zone, script.start()); |
328 auto callable = tester.GetCallable<Handle<Object>>(); | 328 auto callable = tester.GetCallable<Handle<Object>>(); |
329 Handle<Object> return_value = | 329 Handle<Object> return_value = |
330 callable(snippets[i].parameter(0)).ToHandleChecked(); | 330 callable(snippets[i].parameter(0)).ToHandleChecked(); |
331 CHECK(return_value->SameValue(*snippets[i].return_value())); | 331 CHECK(return_value->SameValue(*snippets[i].return_value())); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
| 335 |
| 336 TEST(BytecodeGraphBuilderPropertyCall) { |
| 337 HandleAndZoneScope scope; |
| 338 Isolate* isolate = scope.main_isolate(); |
| 339 Zone* zone = scope.main_zone(); |
| 340 Factory* factory = isolate->factory(); |
| 341 |
| 342 ExpectedSnippet<1> snippets[] = { |
| 343 {"return p1.func();", |
| 344 {factory->NewNumberFromInt(25), |
| 345 BytecodeGraphTester::NewObject("({func() { return 25; }})")}}, |
| 346 {"return p1.func('abc');", |
| 347 {factory->NewStringFromStaticChars("abc"), |
| 348 BytecodeGraphTester::NewObject("({func(a) { return a; }})")}}, |
| 349 {"return p1.func(1, 2, 3, 4, 5, 6, 7, 8);", |
| 350 {factory->NewNumberFromInt(36), |
| 351 BytecodeGraphTester::NewObject( |
| 352 "({func(a, b, c, d, e, f, g, h) {\n" |
| 353 " return a + b + c + d + e + f + g + h;}})")}}, |
| 354 }; |
| 355 |
| 356 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
| 357 for (size_t i = 0; i < num_snippets; i++) { |
| 358 ScopedVector<char> script(2048); |
| 359 SNPrintF(script, "function %s(p1) { %s };\n%s({func() {}});", kFunctionName, |
| 360 snippets[i].code_snippet, kFunctionName); |
| 361 |
| 362 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 363 auto callable = tester.GetCallable<Handle<Object>>(); |
| 364 Handle<Object> return_value = |
| 365 callable(snippets[i].parameter(0)).ToHandleChecked(); |
| 366 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 367 } |
| 368 } |
| 369 |
335 } // namespace compiler | 370 } // namespace compiler |
336 } // namespace internal | 371 } // namespace internal |
337 } // namespace v8 | 372 } // namespace v8 |
OLD | NEW |