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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 | 495 |
| 496 Literal* Parser::ExpressionFromLiteral(Token::Value token, int pos) { | 496 Literal* Parser::ExpressionFromLiteral(Token::Value token, int pos) { |
| 497 switch (token) { | 497 switch (token) { |
| 498 case Token::NULL_LITERAL: | 498 case Token::NULL_LITERAL: |
| 499 return factory()->NewNullLiteral(pos); | 499 return factory()->NewNullLiteral(pos); |
| 500 case Token::TRUE_LITERAL: | 500 case Token::TRUE_LITERAL: |
| 501 return factory()->NewBooleanLiteral(true, pos); | 501 return factory()->NewBooleanLiteral(true, pos); |
| 502 case Token::FALSE_LITERAL: | 502 case Token::FALSE_LITERAL: |
| 503 return factory()->NewBooleanLiteral(false, pos); | 503 return factory()->NewBooleanLiteral(false, pos); |
| 504 case Token::SMI: { | 504 case Token::SMI: { |
| 505 int value = scanner()->smi_value(); | 505 uint32_t value = scanner()->smi_value(); |
| 506 return factory()->NewSmiLiteral(value, pos); | 506 return factory()->NewSmiLiteral(value, pos); |
| 507 } | 507 } |
| 508 case Token::NUMBER: { | 508 case Token::NUMBER: { |
| 509 bool has_dot = scanner()->ContainsDot(); | 509 bool has_dot = scanner()->ContainsDot(); |
| 510 double value = scanner()->DoubleValue(); | 510 double value = scanner()->DoubleValue(); |
| 511 return factory()->NewNumberLiteral(value, pos, has_dot); | 511 return factory()->NewNumberLiteral(value, pos, has_dot); |
| 512 } | 512 } |
| 513 default: | 513 default: |
| 514 DCHECK(false); | 514 DCHECK(false); |
| 515 } | 515 } |
| (...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3915 args->Add(factory()->NewArrayLiteral( | 3915 args->Add(factory()->NewArrayLiteral( |
| 3916 const_cast<ZoneList<Expression*>*>(cooked_strings), | 3916 const_cast<ZoneList<Expression*>*>(cooked_strings), |
| 3917 cooked_idx, pos), | 3917 cooked_idx, pos), |
| 3918 zone()); | 3918 zone()); |
| 3919 args->Add( | 3919 args->Add( |
| 3920 factory()->NewArrayLiteral( | 3920 factory()->NewArrayLiteral( |
| 3921 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), | 3921 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), |
| 3922 zone()); | 3922 zone()); |
| 3923 | 3923 |
| 3924 // Ensure hash is suitable as a Smi value | 3924 // Ensure hash is suitable as a Smi value |
| 3925 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); | 3925 DCHECK(Smi::IsValid(static_cast<intptr_t>(hash))); |
|
vogelheim
2016/11/09 15:04:10
I don't get this change.
What does this do, and h
vogelheim
2016/11/09 15:05:18
Ah, I see patch set 4 resolves this.
| |
| 3926 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); | 3926 args->Add(factory()->NewSmiLiteral(hash, pos), zone()); |
| 3927 | 3927 |
| 3928 Expression* call_site = factory()->NewCallRuntime( | 3928 Expression* call_site = factory()->NewCallRuntime( |
| 3929 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); | 3929 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); |
| 3930 | 3930 |
| 3931 // Call TagFn | 3931 // Call TagFn |
| 3932 ZoneList<Expression*>* call_args = | 3932 ZoneList<Expression*>* call_args = |
| 3933 new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone()); | 3933 new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone()); |
| 3934 call_args->Add(call_site, zone()); | 3934 call_args->Add(call_site, zone()); |
| 3935 call_args->AddAll(*expressions, zone()); | 3935 call_args->AddAll(*expressions, zone()); |
| 3936 return factory()->NewCall(tag, call_args, pos); | 3936 return factory()->NewCall(tag, call_args, pos); |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5419 | 5419 |
| 5420 return final_loop; | 5420 return final_loop; |
| 5421 } | 5421 } |
| 5422 | 5422 |
| 5423 #undef CHECK_OK | 5423 #undef CHECK_OK |
| 5424 #undef CHECK_OK_VOID | 5424 #undef CHECK_OK_VOID |
| 5425 #undef CHECK_FAILED | 5425 #undef CHECK_FAILED |
| 5426 | 5426 |
| 5427 } // namespace internal | 5427 } // namespace internal |
| 5428 } // namespace v8 | 5428 } // namespace v8 |
| OLD | NEW |