OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 int* stack_depth, | 1309 int* stack_depth, |
1310 int* context_length) { | 1310 int* context_length) { |
1311 // The macros used here must preserve the result register. | 1311 // The macros used here must preserve the result register. |
1312 __ Drop(*stack_depth); | 1312 __ Drop(*stack_depth); |
1313 __ PopTryHandler(); | 1313 __ PopTryHandler(); |
1314 *stack_depth = 0; | 1314 *stack_depth = 0; |
1315 return previous_; | 1315 return previous_; |
1316 } | 1316 } |
1317 | 1317 |
1318 | 1318 |
1319 bool FullCodeGenerator::TryLiteralCompare(CompareOperation* compare, | 1319 bool FullCodeGenerator::TryLiteralCompare(CompareOperation* expr) { |
1320 Label* if_true, | 1320 Expression *sub_expr; |
1321 Label* if_false, | |
1322 Label* fall_through) { | |
1323 bool is_strict = compare->op() == Token::EQ_STRICT; | |
1324 Expression *expr; | |
1325 Handle<String> check; | 1321 Handle<String> check; |
1326 if (compare->IsLiteralCompareTypeof(&expr, &check)) { | 1322 if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) { |
1327 EmitLiteralCompareTypeof(expr, check, if_true, if_false, fall_through); | 1323 EmitLiteralCompareTypeof(sub_expr, check); |
1328 return true; | 1324 return true; |
1329 } | 1325 } |
1330 | 1326 |
1331 if (compare->IsLiteralCompareUndefined(&expr)) { | 1327 if (expr->IsLiteralCompareUndefined(&sub_expr)) { |
1332 EmitLiteralCompareUndefined(expr, if_true, if_false, fall_through); | 1328 EmitLiteralCompareNil(expr, sub_expr, kUndefinedValue); |
1333 return true; | 1329 return true; |
1334 } | 1330 } |
1335 | 1331 |
1336 if (compare->IsLiteralCompareNull(&expr)) { | 1332 if (expr->IsLiteralCompareNull(&sub_expr)) { |
1337 EmitLiteralCompareNull(expr, is_strict, if_true, if_false, fall_through); | 1333 EmitLiteralCompareNil(expr, sub_expr, kNullValue); |
1338 return true; | 1334 return true; |
1339 } | 1335 } |
1340 | 1336 |
1341 return false; | 1337 return false; |
1342 } | 1338 } |
1343 | 1339 |
1344 | 1340 |
1345 #undef __ | 1341 #undef __ |
1346 | 1342 |
1347 | 1343 |
1348 } } // namespace v8::internal | 1344 } } // namespace v8::internal |
OLD | NEW |