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

Side by Side Diff: src/ast.cc

Issue 19556003: Fix LiteralCompareTypeof breakage introduced in r15723 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 352
353 // Check for the pattern: typeof <expression> equals <string literal>. 353 // Check for the pattern: typeof <expression> equals <string literal>.
354 static bool MatchLiteralCompareTypeof(Expression* left, 354 static bool MatchLiteralCompareTypeof(Expression* left,
355 Token::Value op, 355 Token::Value op,
356 Expression* right, 356 Expression* right,
357 Expression** expr, 357 Expression** expr,
358 Handle<String>* check) { 358 Handle<String>* check) {
359 if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) { 359 if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) {
360 *expr = left->AsUnaryOperation()->expression(); 360 *expr = left;
361 *check = Handle<String>::cast(right->AsLiteral()->value()); 361 *check = Handle<String>::cast(right->AsLiteral()->value());
362 return true; 362 return true;
363 } 363 }
364 return false; 364 return false;
365 } 365 }
366 366
367 367
368 bool CompareOperation::IsLiteralCompareTypeof(Expression** expr, 368 bool CompareOperation::IsLiteralCompareTypeof(Expression** expr,
369 Handle<String>* check) { 369 Handle<String>* check) {
370 return MatchLiteralCompareTypeof(left_, op_, right_, expr, check) || 370 return MatchLiteralCompareTypeof(left_, op_, right_, expr, check) ||
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1187 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1188 str = arr; 1188 str = arr;
1189 } else { 1189 } else {
1190 str = DoubleToCString(value_->Number(), buffer); 1190 str = DoubleToCString(value_->Number(), buffer);
1191 } 1191 }
1192 return factory->NewStringFromAscii(CStrVector(str)); 1192 return factory->NewStringFromAscii(CStrVector(str));
1193 } 1193 }
1194 1194
1195 1195
1196 } } // namespace v8::internal 1196 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698