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 } |
517 } | 522 } |
518 return false; | 523 return false; |
519 } | 524 } |
520 | 525 |
521 | 526 |
522 Expression* ParserTraits::BuildUnaryExpression(Expression* expression, | 527 Expression* ParserTraits::BuildUnaryExpression(Expression* expression, |
523 Token::Value op, int pos, | 528 Token::Value op, int pos, |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 813 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
809 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 814 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
810 set_allow_harmony_classes(FLAG_harmony_classes); | 815 set_allow_harmony_classes(FLAG_harmony_classes); |
811 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 816 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
812 set_allow_harmony_templates(FLAG_harmony_templates); | 817 set_allow_harmony_templates(FLAG_harmony_templates); |
813 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 818 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
814 set_allow_harmony_unicode(FLAG_harmony_unicode); | 819 set_allow_harmony_unicode(FLAG_harmony_unicode); |
815 set_allow_harmony_computed_property_names( | 820 set_allow_harmony_computed_property_names( |
816 FLAG_harmony_computed_property_names); | 821 FLAG_harmony_computed_property_names); |
817 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); | 822 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); |
| 823 set_allow_harmony_exponentiation(FLAG_harmony_exponentiation); |
818 set_allow_strong_mode(FLAG_strong_mode); | 824 set_allow_strong_mode(FLAG_strong_mode); |
819 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 825 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
820 ++feature) { | 826 ++feature) { |
821 use_counts_[feature] = 0; | 827 use_counts_[feature] = 0; |
822 } | 828 } |
823 if (info->ast_value_factory() == NULL) { | 829 if (info->ast_value_factory() == NULL) { |
824 // info takes ownership of AstValueFactory. | 830 // info takes ownership of AstValueFactory. |
825 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); | 831 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); |
826 ast_value_factory_ = info->ast_value_factory(); | 832 ast_value_factory_ = info->ast_value_factory(); |
827 } | 833 } |
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 4032 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); |
4027 reusable_preparser_->set_allow_harmony_object_literals( | 4033 reusable_preparser_->set_allow_harmony_object_literals( |
4028 allow_harmony_object_literals()); | 4034 allow_harmony_object_literals()); |
4029 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); | 4035 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); |
4030 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4036 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
4031 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); | 4037 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); |
4032 reusable_preparser_->set_allow_harmony_computed_property_names( | 4038 reusable_preparser_->set_allow_harmony_computed_property_names( |
4033 allow_harmony_computed_property_names()); | 4039 allow_harmony_computed_property_names()); |
4034 reusable_preparser_->set_allow_harmony_rest_params( | 4040 reusable_preparser_->set_allow_harmony_rest_params( |
4035 allow_harmony_rest_params()); | 4041 allow_harmony_rest_params()); |
| 4042 reusable_preparser_->set_allow_harmony_exponentiation( |
| 4043 allow_harmony_exponentiation()); |
4036 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); | 4044 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); |
4037 } | 4045 } |
4038 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 4046 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
4039 language_mode(), function_state_->kind(), logger); | 4047 language_mode(), function_state_->kind(), logger); |
4040 if (pre_parse_timer_ != NULL) { | 4048 if (pre_parse_timer_ != NULL) { |
4041 pre_parse_timer_->Stop(); | 4049 pre_parse_timer_->Stop(); |
4042 } | 4050 } |
4043 return result; | 4051 return result; |
4044 } | 4052 } |
4045 | 4053 |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5463 } else { | 5471 } else { |
5464 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5472 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5465 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5473 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5466 raw_string->length()); | 5474 raw_string->length()); |
5467 } | 5475 } |
5468 } | 5476 } |
5469 | 5477 |
5470 return running_hash; | 5478 return running_hash; |
5471 } | 5479 } |
5472 } } // namespace v8::internal | 5480 } } // namespace v8::internal |
OLD | NEW |