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

Side by Side Diff: src/ast/ast.h

Issue 1570793002: [parser] parenthesized Literals are not valid AssignmentPatterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO + move ParenthesizedField line above Type-dependent fields/comments Created 4 years, 11 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 | « no previous file | src/parsing/parser.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 #ifndef V8_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 358 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
359 uint16_t to_boolean_types() const { 359 uint16_t to_boolean_types() const {
360 return ToBooleanTypesField::decode(bit_field_); 360 return ToBooleanTypesField::decode(bit_field_);
361 } 361 }
362 362
363 void set_base_id(int id) { base_id_ = id; } 363 void set_base_id(int id) { base_id_ = id; }
364 static int num_ids() { return parent_num_ids() + 2; } 364 static int num_ids() { return parent_num_ids() + 2; }
365 BailoutId id() const { return BailoutId(local_id(0)); } 365 BailoutId id() const { return BailoutId(local_id(0)); }
366 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } 366 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); }
367 367
368 // Parenthesized expressions in the form `( Expression )`.
369 void set_is_parenthesized() {
370 bit_field_ = ParenthesizedField::update(bit_field_, true);
371 }
372 bool is_parenthesized() const {
373 return ParenthesizedField::decode(bit_field_);
374 }
375
368 protected: 376 protected:
369 Expression(Zone* zone, int pos) 377 Expression(Zone* zone, int pos)
370 : AstNode(pos), 378 : AstNode(pos),
371 base_id_(BailoutId::None().ToInt()), 379 base_id_(BailoutId::None().ToInt()),
372 bounds_(Bounds::Unbounded()), 380 bounds_(Bounds::Unbounded()),
373 bit_field_(0) {} 381 bit_field_(0) {}
374 static int parent_num_ids() { return 0; } 382 static int parent_num_ids() { return 0; }
375 void set_to_boolean_types(uint16_t types) { 383 void set_to_boolean_types(uint16_t types) {
376 bit_field_ = ToBooleanTypesField::update(bit_field_, types); 384 bit_field_ = ToBooleanTypesField::update(bit_field_, types);
377 } 385 }
378 386
379 int base_id() const { 387 int base_id() const {
380 DCHECK(!BailoutId(base_id_).IsNone()); 388 DCHECK(!BailoutId(base_id_).IsNone());
381 return base_id_; 389 return base_id_;
382 } 390 }
383 391
384 private: 392 private:
385 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 393 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
386 394
387 int base_id_; 395 int base_id_;
388 Bounds bounds_; 396 Bounds bounds_;
389 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; 397 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {};
398 class ParenthesizedField
399 : public BitField16<bool, ToBooleanTypesField::kNext, 1> {};
390 uint16_t bit_field_; 400 uint16_t bit_field_;
391 // Ends with 16-bit field; deriving classes in turn begin with 401 // Ends with 16-bit field; deriving classes in turn begin with
392 // 16-bit fields for optimum packing efficiency. 402 // 16-bit fields for optimum packing efficiency.
393 }; 403 };
394 404
395 405
396 class BreakableStatement : public Statement { 406 class BreakableStatement : public Statement {
397 public: 407 public:
398 enum BreakableType { 408 enum BreakableType {
399 TARGET_FOR_ANONYMOUS, 409 TARGET_FOR_ANONYMOUS,
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 // the parser-level zone. 3414 // the parser-level zone.
3405 Zone* parser_zone_; 3415 Zone* parser_zone_;
3406 AstValueFactory* ast_value_factory_; 3416 AstValueFactory* ast_value_factory_;
3407 }; 3417 };
3408 3418
3409 3419
3410 } // namespace internal 3420 } // namespace internal
3411 } // namespace v8 3421 } // namespace v8
3412 3422
3413 #endif // V8_AST_AST_H_ 3423 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698