Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 uint32_t value = DoubleToUint32(x_val) >> shift; | 504 uint32_t value = DoubleToUint32(x_val) >> shift; |
| 505 *x = factory->NewNumberLiteral(value, pos); | 505 *x = factory->NewNumberLiteral(value, pos); |
| 506 return true; | 506 return true; |
| 507 } | 507 } |
| 508 case Token::SAR: { | 508 case Token::SAR: { |
| 509 uint32_t shift = DoubleToInt32(y_val) & 0x1f; | 509 uint32_t shift = DoubleToInt32(y_val) & 0x1f; |
| 510 int value = ArithmeticShiftRight(DoubleToInt32(x_val), shift); | 510 int value = ArithmeticShiftRight(DoubleToInt32(x_val), shift); |
| 511 *x = factory->NewNumberLiteral(value, pos); | 511 *x = factory->NewNumberLiteral(value, pos); |
| 512 return true; | 512 return true; |
| 513 } | 513 } |
| 514 case Token::EXP: { | |
| 515 double value = power_helper(x_val, y_val); | |
| 516 *x = factory->NewNumberLiteral(value, pos); | |
| 517 return true; | |
| 518 } | |
| 514 default: | 519 default: |
| 515 break; | 520 break; |
| 516 } | 521 } |
| 522 } else if (op == Token::EXP) { | |
| 523 Zone* zone = parser_->zone(); | |
| 524 AstValueFactory* ast_value_factory = parser_->ast_value_factory(); | |
|
arv (Not doing code reviews)
2015/02/25 16:58:25
just inline this
caitp (gmail)
2015/02/25 20:52:59
Acknowledged.
| |
| 525 | |
| 526 // Desugar exponentiation to runtime call | |
| 527 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(2, zone); | |
| 528 args->Add(*x, zone); | |
| 529 args->Add(y, zone); | |
| 530 *x = factory->NewCallRuntime(ast_value_factory->math_pow_string(), NULL, | |
| 531 args, pos); | |
| 532 return true; | |
| 517 } | 533 } |
| 518 return false; | 534 return false; |
| 519 } | 535 } |
| 520 | 536 |
| 521 | 537 |
| 522 Expression* ParserTraits::BuildUnaryExpression(Expression* expression, | 538 Expression* ParserTraits::BuildUnaryExpression(Expression* expression, |
| 523 Token::Value op, int pos, | 539 Token::Value op, int pos, |
| 524 AstNodeFactory* factory) { | 540 AstNodeFactory* factory) { |
| 525 DCHECK(expression != NULL); | 541 DCHECK(expression != NULL); |
| 526 if (expression->IsLiteral()) { | 542 if (expression->IsLiteral()) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 808 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 824 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
| 809 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 825 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
| 810 set_allow_harmony_classes(FLAG_harmony_classes); | 826 set_allow_harmony_classes(FLAG_harmony_classes); |
| 811 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 827 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
| 812 set_allow_harmony_templates(FLAG_harmony_templates); | 828 set_allow_harmony_templates(FLAG_harmony_templates); |
| 813 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 829 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
| 814 set_allow_harmony_unicode(FLAG_harmony_unicode); | 830 set_allow_harmony_unicode(FLAG_harmony_unicode); |
| 815 set_allow_harmony_computed_property_names( | 831 set_allow_harmony_computed_property_names( |
| 816 FLAG_harmony_computed_property_names); | 832 FLAG_harmony_computed_property_names); |
| 817 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); | 833 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); |
| 834 set_allow_harmony_exponentiation(FLAG_harmony_exponentiation); | |
| 818 set_allow_strong_mode(FLAG_strong_mode); | 835 set_allow_strong_mode(FLAG_strong_mode); |
| 819 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 836 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
| 820 ++feature) { | 837 ++feature) { |
| 821 use_counts_[feature] = 0; | 838 use_counts_[feature] = 0; |
| 822 } | 839 } |
| 823 if (info->ast_value_factory() == NULL) { | 840 if (info->ast_value_factory() == NULL) { |
| 824 // info takes ownership of AstValueFactory. | 841 // info takes ownership of AstValueFactory. |
| 825 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); | 842 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); |
| 826 ast_value_factory_ = info->ast_value_factory(); | 843 ast_value_factory_ = info->ast_value_factory(); |
| 827 } | 844 } |
| (...skipping 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4052 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 4069 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); |
| 4053 reusable_preparser_->set_allow_harmony_object_literals( | 4070 reusable_preparser_->set_allow_harmony_object_literals( |
| 4054 allow_harmony_object_literals()); | 4071 allow_harmony_object_literals()); |
| 4055 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); | 4072 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); |
| 4056 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4073 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
| 4057 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); | 4074 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); |
| 4058 reusable_preparser_->set_allow_harmony_computed_property_names( | 4075 reusable_preparser_->set_allow_harmony_computed_property_names( |
| 4059 allow_harmony_computed_property_names()); | 4076 allow_harmony_computed_property_names()); |
| 4060 reusable_preparser_->set_allow_harmony_rest_params( | 4077 reusable_preparser_->set_allow_harmony_rest_params( |
| 4061 allow_harmony_rest_params()); | 4078 allow_harmony_rest_params()); |
| 4079 reusable_preparser_->set_allow_harmony_exponentiation( | |
| 4080 allow_harmony_exponentiation()); | |
| 4062 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); | 4081 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); |
| 4063 } | 4082 } |
| 4064 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 4083 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
| 4065 language_mode(), function_state_->kind(), logger); | 4084 language_mode(), function_state_->kind(), logger); |
| 4066 if (pre_parse_timer_ != NULL) { | 4085 if (pre_parse_timer_ != NULL) { |
| 4067 pre_parse_timer_->Stop(); | 4086 pre_parse_timer_->Stop(); |
| 4068 } | 4087 } |
| 4069 return result; | 4088 return result; |
| 4070 } | 4089 } |
| 4071 | 4090 |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5485 } else { | 5504 } else { |
| 5486 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5505 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
| 5487 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5506 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
| 5488 raw_string->length()); | 5507 raw_string->length()); |
| 5489 } | 5508 } |
| 5490 } | 5509 } |
| 5491 | 5510 |
| 5492 return running_hash; | 5511 return running_hash; |
| 5493 } | 5512 } |
| 5494 } } // namespace v8::internal | 5513 } } // namespace v8::internal |
| OLD | NEW |