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

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

Issue 1541143003: [Interpreter] Adds support for Load/Store LookupSlots to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an extra line in bytecode-graph-builder.h. Created 4 years, 12 months 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 5 #include <utility>
6 6
7 #include "src/compiler/pipeline.h" 7 #include "src/compiler/pipeline.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/interpreter/bytecode-array-builder.h" 10 #include "src/interpreter/bytecode-array-builder.h"
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 function_epilogue); 1009 function_epilogue);
1010 1010
1011 BytecodeGraphTester tester(isolate, zone, script.start(), "t"); 1011 BytecodeGraphTester tester(isolate, zone, script.start(), "t");
1012 auto callable = tester.GetCallable<>(); 1012 auto callable = tester.GetCallable<>();
1013 Handle<Object> return_value = callable().ToHandleChecked(); 1013 Handle<Object> return_value = callable().ToHandleChecked();
1014 CHECK(return_value->SameValue(*snippets[i].return_value())); 1014 CHECK(return_value->SameValue(*snippets[i].return_value()));
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 1018
1019 TEST(BytecodeGraphBuilderLookupSlot) {
1020 HandleAndZoneScope scope;
1021 Isolate* isolate = scope.main_isolate();
1022 Zone* zone = scope.main_zone();
1023 Factory* factory = isolate->factory();
1024
1025 const char* function_prologue = "var f;"
1026 "var x = 12;"
1027 "y = 10;"
1028 "var obj = {val:3.1414};"
1029 "var z = 30;"
1030 "function f1() {"
1031 " var z = 20;"
1032 " eval(\"function t() {";
1033 const char* function_epilogue = " }; f = t; t();\");"
1034 "}"
1035 "f1();";
1036
1037 ExpectedSnippet<0> snippets[] = {
1038 {"return x;", {factory->NewNumber(12)}},
1039 {"return obj.val;", {factory->NewNumber(3.1414)}},
1040 {"return typeof x;", {factory->NewStringFromStaticChars("number")}},
1041 {"x = 23; return x;", {factory->NewNumber(23)}},
1042 {"'use strict'; obj.val = 23.456; return obj.val;",
1043 {factory->NewNumber(23.456)}}};
1044
1045 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
1046 for (size_t i = 0; i < num_snippets; i++) {
1047 ScopedVector<char> script(1024);
1048 SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet,
1049 function_epilogue);
1050
1051 BytecodeGraphTester tester(isolate, zone, script.start(), "t");
1052 auto callable = tester.GetCallable<>();
1053 Handle<Object> return_value = callable().ToHandleChecked();
1054 CHECK(return_value->SameValue(*snippets[i].return_value()));
1055 }
1056 }
1057
1058
1019 bool get_compare_result(Token::Value opcode, Handle<Object> lhs_value, 1059 bool get_compare_result(Token::Value opcode, Handle<Object> lhs_value,
1020 Handle<Object> rhs_value) { 1060 Handle<Object> rhs_value) {
1021 switch (opcode) { 1061 switch (opcode) {
1022 case Token::Value::EQ: 1062 case Token::Value::EQ:
1023 return Object::Equals(lhs_value, rhs_value).FromJust(); 1063 return Object::Equals(lhs_value, rhs_value).FromJust();
1024 case Token::Value::NE: 1064 case Token::Value::NE:
1025 return !Object::Equals(lhs_value, rhs_value).FromJust(); 1065 return !Object::Equals(lhs_value, rhs_value).FromJust();
1026 case Token::Value::EQ_STRICT: 1066 case Token::Value::EQ_STRICT:
1027 return lhs_value->StrictEquals(*rhs_value); 1067 return lhs_value->StrictEquals(*rhs_value);
1028 case Token::Value::NE_STRICT: 1068 case Token::Value::NE_STRICT:
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 auto callable = tester.GetCallable<>(); 2102 auto callable = tester.GetCallable<>();
2063 Handle<Object> return_value = callable().ToHandleChecked(); 2103 Handle<Object> return_value = callable().ToHandleChecked();
2064 CHECK(return_value->SameValue(*snippets[i].return_value())); 2104 CHECK(return_value->SameValue(*snippets[i].return_value()));
2065 } 2105 }
2066 } 2106 }
2067 2107
2068 2108
2069 } // namespace compiler 2109 } // namespace compiler
2070 } // namespace internal 2110 } // namespace internal
2071 } // namespace v8 2111 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698