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

Side by Side Diff: src/parsing/parser.cc

Issue 2305883002: Remove unnessary includes of parser.h (Closed)
Patch Set: More fixes in asm-js.h Created 4 years, 3 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/parsing/parser.h ('k') | src/runtime/runtime-literals.cc » ('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/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 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 // DebuggerStatement :: 3442 // DebuggerStatement ::
3443 // 'debugger' ';' 3443 // 'debugger' ';'
3444 3444
3445 int pos = peek_position(); 3445 int pos = peek_position();
3446 Expect(Token::DEBUGGER, CHECK_OK); 3446 Expect(Token::DEBUGGER, CHECK_OK);
3447 ExpectSemicolon(CHECK_OK); 3447 ExpectSemicolon(CHECK_OK);
3448 return factory()->NewDebuggerStatement(pos); 3448 return factory()->NewDebuggerStatement(pos);
3449 } 3449 }
3450 3450
3451 3451
3452 bool CompileTimeValue::IsCompileTimeValue(Expression* expression) {
3453 if (expression->IsLiteral()) return true;
3454 MaterializedLiteral* lit = expression->AsMaterializedLiteral();
3455 return lit != NULL && lit->is_simple();
3456 }
3457
3458
3459 Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate,
3460 Expression* expression) {
3461 Factory* factory = isolate->factory();
3462 DCHECK(IsCompileTimeValue(expression));
3463 Handle<FixedArray> result = factory->NewFixedArray(2, TENURED);
3464 ObjectLiteral* object_literal = expression->AsObjectLiteral();
3465 if (object_literal != NULL) {
3466 DCHECK(object_literal->is_simple());
3467 if (object_literal->fast_elements()) {
3468 result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_FAST_ELEMENTS));
3469 } else {
3470 result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_SLOW_ELEMENTS));
3471 }
3472 result->set(kElementsSlot, *object_literal->constant_properties());
3473 } else {
3474 ArrayLiteral* array_literal = expression->AsArrayLiteral();
3475 DCHECK(array_literal != NULL && array_literal->is_simple());
3476 result->set(kLiteralTypeSlot, Smi::FromInt(ARRAY_LITERAL));
3477 result->set(kElementsSlot, *array_literal->constant_elements());
3478 }
3479 return result;
3480 }
3481
3482
3483 CompileTimeValue::LiteralType CompileTimeValue::GetLiteralType(
3484 Handle<FixedArray> value) {
3485 Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot));
3486 return static_cast<LiteralType>(literal_type->value());
3487 }
3488
3489
3490 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) {
3491 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot)));
3492 }
3493
3494 void Parser::ParseArrowFunctionFormalParameters( 3452 void Parser::ParseArrowFunctionFormalParameters(
3495 ParserFormalParameters* parameters, Expression* expr, int end_pos, 3453 ParserFormalParameters* parameters, Expression* expr, int end_pos,
3496 bool* ok) { 3454 bool* ok) {
3497 // ArrowFunctionFormals :: 3455 // ArrowFunctionFormals ::
3498 // Binary(Token::COMMA, NonTailArrowFunctionFormals, Tail) 3456 // Binary(Token::COMMA, NonTailArrowFunctionFormals, Tail)
3499 // Tail 3457 // Tail
3500 // NonTailArrowFunctionFormals :: 3458 // NonTailArrowFunctionFormals ::
3501 // Binary(Token::COMMA, NonTailArrowFunctionFormals, VariableProxy) 3459 // Binary(Token::COMMA, NonTailArrowFunctionFormals, VariableProxy)
3502 // VariableProxy 3460 // VariableProxy
3503 // Tail :: 3461 // Tail ::
(...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after
6490 node->Print(Isolate::Current()); 6448 node->Print(Isolate::Current());
6491 } 6449 }
6492 #endif // DEBUG 6450 #endif // DEBUG
6493 6451
6494 #undef CHECK_OK 6452 #undef CHECK_OK
6495 #undef CHECK_OK_VOID 6453 #undef CHECK_OK_VOID
6496 #undef CHECK_FAILED 6454 #undef CHECK_FAILED
6497 6455
6498 } // namespace internal 6456 } // namespace internal
6499 } // namespace v8 6457 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.h ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698