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

Side by Side Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1437873002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mythri_load
Patch Set: Update to directly build bytecode in unittest Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 snippets[i].code_snippet, kFunctionName); 324 snippets[i].code_snippet, kFunctionName);
325 325
326 BytecodeGraphTester tester(isolate, zone, script.start()); 326 BytecodeGraphTester tester(isolate, zone, script.start());
327 auto callable = tester.GetCallable<Handle<Object>>(); 327 auto callable = tester.GetCallable<Handle<Object>>();
328 Handle<Object> return_value = 328 Handle<Object> return_value =
329 callable(snippets[i].parameter(0)).ToHandleChecked(); 329 callable(snippets[i].parameter(0)).ToHandleChecked();
330 CHECK(return_value->SameValue(*snippets[i].return_value())); 330 CHECK(return_value->SameValue(*snippets[i].return_value()));
331 } 331 }
332 } 332 }
333 333
334
335 TEST(BytecodeGraphBuilderPropertyCall) {
336 HandleAndZoneScope scope;
337 Isolate* isolate = scope.main_isolate();
338 Zone* zone = scope.main_zone();
339 Factory* factory = isolate->factory();
340
341 ExpectedSnippet<1> snippets[] = {
342 {"return p1.func();",
343 {factory->NewNumberFromInt(25),
344 BytecodeGraphTester::NewObject("({func() { return 25; }})")}},
345 {"return p1.func('abc');",
346 {factory->NewStringFromStaticChars("abc"),
347 BytecodeGraphTester::NewObject("({func(a) { return a; }})")}},
348 {"return p1.func(1, 2, 3, 4, 5, 6, 7, 8);",
349 {factory->NewNumberFromInt(36),
350 BytecodeGraphTester::NewObject(
351 "({func(a, b, c, d, e, f, g, h) {\n"
352 " return a + b + c + d + e + f + g + h;}})")}},
353 };
354
355 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
356 for (size_t i = 0; i < num_snippets; i++) {
357 ScopedVector<char> script(2048);
358 SNPrintF(script, "function %s(p1) { %s };\n%s({func() {}});", kFunctionName,
359 snippets[i].code_snippet, kFunctionName);
360
361 BytecodeGraphTester tester(isolate, zone, script.start());
362 auto callable = tester.GetCallable<Handle<Object>>();
363 Handle<Object> return_value =
364 callable(snippets[i].parameter(0)).ToHandleChecked();
365 CHECK(return_value->SameValue(*snippets[i].return_value()));
366 }
367 }
368
334 } // namespace compiler 369 } // namespace compiler
335 } // namespace internal 370 } // namespace internal
336 } // namespace v8 371 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698