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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1390483002: [Interpreter] Unary operators - typeof, void, and logical not. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate review comments on patch set 3. Created 5 years, 2 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
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index a66e44a145d48144bc46a4799c0f11a1ecfbe6b3..df9f21cb8529556672d6f84d50d2ffe69200aeb8 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -619,8 +619,41 @@ void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
}
+void BytecodeGenerator::VisitVoid(UnaryOperation* expr) {
+ Visit(expr->expression());
+ builder()->LoadUndefined();
+}
+
+
+void BytecodeGenerator::VisitTypeOf(UnaryOperation* expr) {
+ Visit(expr->expression());
+ builder()->TypeOf();
+}
+
+
+void BytecodeGenerator::VisitNot(UnaryOperation* expr) {
+ Visit(expr->expression());
+ builder()->LogicalNot();
+}
+
+
void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- UNIMPLEMENTED();
+ switch (expr->op()) {
+ case Token::Value::NOT:
+ VisitNot(expr);
+ break;
+ case Token::Value::TYPEOF:
+ VisitTypeOf(expr);
+ break;
+ case Token::Value::VOID:
+ VisitVoid(expr);
+ break;
+ case Token::Value::BIT_NOT:
+ case Token::Value::DELETE:
+ UNIMPLEMENTED();
+ default:
+ UNREACHABLE();
+ }
}
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698