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

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1980483003: [es6] Reintroduce the instanceof operator in the backends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Igors comments. Created 4 years, 7 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
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/execution.h" 7 #include "src/execution.h"
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/interpreter/bytecode-array-builder.h" 9 #include "src/interpreter/bytecode-array-builder.h"
10 #include "src/interpreter/bytecode-array-iterator.h" 10 #include "src/interpreter/bytecode-array-iterator.h"
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 CHECK(return_value->IsBoolean()); 1376 CHECK(return_value->IsBoolean());
1377 CHECK_EQ(return_value->BooleanValue(), 1377 CHECK_EQ(return_value->BooleanValue(),
1378 CompareC(Token::Value::NE_STRICT, inputs_number[i], 1378 CompareC(Token::Value::NE_STRICT, inputs_number[i],
1379 inputs_number[j])); 1379 inputs_number[j]));
1380 } 1380 }
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 TEST(InterpreterInstanceOf) { 1384 TEST(InterpreterInstanceOf) {
1385 HandleAndZoneScope handles; 1385 HandleAndZoneScope handles;
1386 // TODO(4447): The new ES6 'instanceof' operator is fully desugared in the
1387 // parser and the Token::INSTANCEOF is not needed anymore. This test only
1388 // makes sense with --no-harmony-instanceof and can be removed once we
1389 // deprecate the ability to switch to old skool ES5 'instanceof' for good.
1390 FLAG_harmony_instanceof = false;
1391 i::Factory* factory = handles.main_isolate()->factory(); 1386 i::Factory* factory = handles.main_isolate()->factory();
1392 Handle<i::String> name = factory->NewStringFromAsciiChecked("cons"); 1387 Handle<i::String> name = factory->NewStringFromAsciiChecked("cons");
1393 Handle<i::JSFunction> func = factory->NewFunction(name); 1388 Handle<i::JSFunction> func = factory->NewFunction(name);
1394 Handle<i::JSObject> instance = factory->NewJSObject(func); 1389 Handle<i::JSObject> instance = factory->NewJSObject(func);
1395 Handle<i::Object> other = factory->NewNumber(3.3333); 1390 Handle<i::Object> other = factory->NewNumber(3.3333);
1396 Handle<i::Object> cases[] = {Handle<i::Object>::cast(instance), other}; 1391 Handle<i::Object> cases[] = {Handle<i::Object>::cast(instance), other};
1397 for (size_t i = 0; i < arraysize(cases); i++) { 1392 for (size_t i = 0; i < arraysize(cases); i++) {
1398 bool expected_value = (i == 0); 1393 bool expected_value = (i == 0);
1399 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, 1394 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0,
1400 0, 1); 1395 0, 1);
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
4168 CHECK(return_value->SameValue(*tests[i].second)); 4163 CHECK(return_value->SameValue(*tests[i].second));
4169 } 4164 }
4170 4165
4171 FLAG_ignition_generators = old_flag; 4166 FLAG_ignition_generators = old_flag;
4172 } 4167 }
4173 4168
4174 4169
4175 } // namespace interpreter 4170 } // namespace interpreter
4176 } // namespace internal 4171 } // namespace internal
4177 } // namespace v8 4172 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/IfConditions.golden ('k') | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698