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 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2548 if (expression != NULL && expression->AsLiteral() && | 2548 if (expression != NULL && expression->AsLiteral() && |
2549 expression->AsLiteral()->handle()->IsNumber()) { | 2549 expression->AsLiteral()->handle()->IsNumber()) { |
2550 double value = expression->AsLiteral()->handle()->Number(); | 2550 double value = expression->AsLiteral()->handle()->Number(); |
2551 switch (op) { | 2551 switch (op) { |
2552 case Token::ADD: | 2552 case Token::ADD: |
2553 return expression; | 2553 return expression; |
2554 case Token::SUB: | 2554 case Token::SUB: |
2555 return NewNumberLiteral(-value); | 2555 return NewNumberLiteral(-value); |
2556 case Token::BIT_NOT: | 2556 case Token::BIT_NOT: |
2557 return NewNumberLiteral(~DoubleToInt32(value)); | 2557 return NewNumberLiteral(~DoubleToInt32(value)); |
2558 case Token::NOT: | |
2559 if (!isnan(value)) { | |
Kevin Millikin (Chromium)
2011/06/14 08:40:35
Does:
bool cond = isnan(value) || (value == 0);
H
| |
2560 Handle<Object> boolean(isolate()->heap()->ToBoolean(value == 0)); | |
2561 return new(zone()) Literal(boolean); | |
2562 } | |
2563 break; | |
2558 default: break; | 2564 default: break; |
2559 } | 2565 } |
2560 } | 2566 } |
2561 | 2567 |
2562 // "delete identifier" is a syntax error in strict mode. | 2568 // "delete identifier" is a syntax error in strict mode. |
2563 if (op == Token::DELETE && top_scope_->is_strict_mode()) { | 2569 if (op == Token::DELETE && top_scope_->is_strict_mode()) { |
2564 VariableProxy* operand = expression->AsVariableProxy(); | 2570 VariableProxy* operand = expression->AsVariableProxy(); |
2565 if (operand != NULL && !operand->is_this()) { | 2571 if (operand != NULL && !operand->is_this()) { |
2566 ReportMessage("strict_delete", Vector<const char*>::empty()); | 2572 ReportMessage("strict_delete", Vector<const char*>::empty()); |
2567 *ok = false; | 2573 *ok = false; |
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4991 info->is_global(), | 4997 info->is_global(), |
4992 info->StrictMode()); | 4998 info->StrictMode()); |
4993 } | 4999 } |
4994 } | 5000 } |
4995 | 5001 |
4996 info->SetFunction(result); | 5002 info->SetFunction(result); |
4997 return (result != NULL); | 5003 return (result != NULL); |
4998 } | 5004 } |
4999 | 5005 |
5000 } } // namespace v8::internal | 5006 } } // namespace v8::internal |
OLD | NEW |