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

Unified Diff: test/cctest/test-api.cc

Issue 7216008: Better codegen for '<expression> === void <literal>'. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Applied your comments. Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« src/ast.cc ('K') | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index e0bcbc92cfabfcdace40f8c63937d20167879516..52045294e7b683849118126a44e170ee10c653be 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -3862,6 +3862,49 @@ THREADED_TEST(UndetectableObject) {
}
+THREADED_TEST(VoidLiteral) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ Local<v8::FunctionTemplate> desc =
+ v8::FunctionTemplate::New(0, v8::Handle<Value>());
+ desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+
+ Local<v8::Object> obj = desc->GetFunction()->NewInstance();
+ env->Global()->Set(v8_str("undetectable"), obj);
+
+ ExpectBoolean("undefined == void 0", true);
+ ExpectBoolean("undetectable == void 0", true);
+ ExpectBoolean("null == void 0", true);
+ ExpectBoolean("undefined === void 0", true);
+ ExpectBoolean("undetectable === void 0", false);
+ ExpectBoolean("null === void 0", false);
+
+ ExpectBoolean("void 0 == undefined", true);
+ ExpectBoolean("void 0 == undetectable", true);
+ ExpectBoolean("void 0 == null", true);
+ ExpectBoolean("void 0 === undefined", true);
+ ExpectBoolean("void 0 === undetectable", false);
+ ExpectBoolean("void 0 === null", false);
+
+ ExpectString("(function() {"
+ " try {"
+ " return x === void 0;"
+ " } catch(e) {"
+ " return e.toString();"
+ " }"
+ "})()",
+ "ReferenceError: x is not defined");
+ ExpectString("(function() {"
+ " try {"
+ " return void 0 === x;"
+ " } catch(e) {"
+ " return e.toString();"
+ " }"
+ "})()",
+ "ReferenceError: x is not defined");
+}
+
THREADED_TEST(ExtensibleOnUndetectable) {
v8::HandleScope scope;
« src/ast.cc ('K') | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698