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

Side by Side Diff: src/parser.cc

Issue 953563002: Implement experimental exponentiation operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use Number() instead of OrderedNumber() to include NaN Created 5 years, 10 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
« no previous file with comments | « src/ic/ic-state.h ('k') | src/preparser.h » ('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 // 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
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
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 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after
4052 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); 4058 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes());
4053 reusable_preparser_->set_allow_harmony_object_literals( 4059 reusable_preparser_->set_allow_harmony_object_literals(
4054 allow_harmony_object_literals()); 4060 allow_harmony_object_literals());
4055 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); 4061 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates());
4056 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); 4062 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy());
4057 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); 4063 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode());
4058 reusable_preparser_->set_allow_harmony_computed_property_names( 4064 reusable_preparser_->set_allow_harmony_computed_property_names(
4059 allow_harmony_computed_property_names()); 4065 allow_harmony_computed_property_names());
4060 reusable_preparser_->set_allow_harmony_rest_params( 4066 reusable_preparser_->set_allow_harmony_rest_params(
4061 allow_harmony_rest_params()); 4067 allow_harmony_rest_params());
4068 reusable_preparser_->set_allow_harmony_exponentiation(
4069 allow_harmony_exponentiation());
4062 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); 4070 reusable_preparser_->set_allow_strong_mode(allow_strong_mode());
4063 } 4071 }
4064 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( 4072 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
4065 language_mode(), function_state_->kind(), logger); 4073 language_mode(), function_state_->kind(), logger);
4066 if (pre_parse_timer_ != NULL) { 4074 if (pre_parse_timer_ != NULL) {
4067 pre_parse_timer_->Stop(); 4075 pre_parse_timer_->Stop();
4068 } 4076 }
4069 return result; 4077 return result;
4070 } 4078 }
4071 4079
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
5485 } else { 5493 } else {
5486 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5494 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5487 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5495 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5488 raw_string->length()); 5496 raw_string->length());
5489 } 5497 }
5490 } 5498 }
5491 5499
5492 return running_hash; 5500 return running_hash;
5493 } 5501 }
5494 } } // namespace v8::internal 5502 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/ic-state.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698