| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Instead of emitting each SSA instruction with a temporary variable | 6 * Instead of emitting each SSA instruction with a temporary variable |
| 7 * mark instructions that can be emitted at their use-site. | 7 * mark instructions that can be emitted at their use-site. |
| 8 * For example, in: | 8 * For example, in: |
| 9 * t0 = 4; | 9 * t0 = 4; |
| 10 * t1 = 3; | 10 * t1 = 3; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 "!==" : const JSBinaryOperatorPrecedence(EQUALITY_PRECEDENCE, | 334 "!==" : const JSBinaryOperatorPrecedence(EQUALITY_PRECEDENCE, |
| 335 RELATIONAL_PRECEDENCE), | 335 RELATIONAL_PRECEDENCE), |
| 336 "<" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | 336 "<" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, |
| 337 SHIFT_PRECEDENCE), | 337 SHIFT_PRECEDENCE), |
| 338 ">" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | 338 ">" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, |
| 339 SHIFT_PRECEDENCE), | 339 SHIFT_PRECEDENCE), |
| 340 "<=" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | 340 "<=" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, |
| 341 SHIFT_PRECEDENCE), | 341 SHIFT_PRECEDENCE), |
| 342 ">=" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | 342 ">=" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, |
| 343 SHIFT_PRECEDENCE), | 343 SHIFT_PRECEDENCE), |
| 344 "in": const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | |
| 345 SHIFT_PRECEDENCE), | |
| 346 "instanceof": const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE, | |
| 347 SHIFT_PRECEDENCE), | |
| 348 "<<" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, | 344 "<<" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, |
| 349 ADDITIVE_PRECEDENCE), | 345 ADDITIVE_PRECEDENCE), |
| 350 ">>" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, | 346 ">>" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, |
| 351 ADDITIVE_PRECEDENCE), | 347 ADDITIVE_PRECEDENCE), |
| 352 ">>>" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, | 348 ">>>" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE, |
| 353 ADDITIVE_PRECEDENCE), | 349 ADDITIVE_PRECEDENCE), |
| 354 "+" : const JSBinaryOperatorPrecedence(ADDITIVE_PRECEDENCE, | 350 "+" : const JSBinaryOperatorPrecedence(ADDITIVE_PRECEDENCE, |
| 355 MULTIPLICATIVE_PRECEDENCE), | 351 MULTIPLICATIVE_PRECEDENCE), |
| 356 "-" : const JSBinaryOperatorPrecedence(ADDITIVE_PRECEDENCE, | 352 "-" : const JSBinaryOperatorPrecedence(ADDITIVE_PRECEDENCE, |
| 357 MULTIPLICATIVE_PRECEDENCE), | 353 MULTIPLICATIVE_PRECEDENCE), |
| 358 "*" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, | 354 "*" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, |
| 359 PREFIX_PRECEDENCE), | 355 PREFIX_PRECEDENCE), |
| 360 "/" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, | 356 "/" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, |
| 361 PREFIX_PRECEDENCE), | 357 PREFIX_PRECEDENCE), |
| 362 "%" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, | 358 "%" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE, |
| 363 PREFIX_PRECEDENCE), | 359 PREFIX_PRECEDENCE), |
| 364 // TODO(lrn): Consider changing rhs to EXPRESSION_PRECEDENCE. | |
| 365 ",": const JSBinaryOperatorPrecedence(EXPRESSION_PRECEDENCE, | |
| 366 ASSIGNMENT_PRECEDENCE), | |
| 367 "=" : const JSAssignmentOperatorPrecedence(), | |
| 368 "+=" : const JSAssignmentOperatorPrecedence(), | |
| 369 "-=" : const JSAssignmentOperatorPrecedence(), | |
| 370 "*=" : const JSAssignmentOperatorPrecedence(), | |
| 371 "/=" : const JSAssignmentOperatorPrecedence(), | |
| 372 "%=" : const JSAssignmentOperatorPrecedence(), | |
| 373 "&=" : const JSAssignmentOperatorPrecedence(), | |
| 374 "|=" : const JSAssignmentOperatorPrecedence(), | |
| 375 "^=" : const JSAssignmentOperatorPrecedence(), | |
| 376 "<<=" : const JSAssignmentOperatorPrecedence(), | |
| 377 ">>=" : const JSAssignmentOperatorPrecedence(), | |
| 378 ">>>=" : const JSAssignmentOperatorPrecedence(), | |
| 379 }; | 360 }; |
| 380 } | 361 } |
| 381 | 362 |
| 382 class JSBinaryOperatorPrecedence { | 363 class JSBinaryOperatorPrecedence { |
| 383 final int left; | 364 final int left; |
| 384 final int right; | 365 final int right; |
| 385 const JSBinaryOperatorPrecedence(this.left, this.right); | 366 const JSBinaryOperatorPrecedence(this.left, this.right); |
| 386 // All non-assignment binary operators are left associative. | 367 // All binary operators (excluding assignment) are left associative. |
| 387 int get precedence() => left; | 368 int get precedence() => left; |
| 388 } | 369 } |
| 389 | |
| 390 class JSAssignmentOperatorPrecedence implements JSBinaryOperatorPrecedence { | |
| 391 const JSAssignmentOperatorPrecedence(); | |
| 392 // The actual left-hand-side of an assignment in JavaScript is the production | |
| 393 // 'LeftHandSideExpression ::= callExpression | newExpression'. We don't | |
| 394 // represent 'newExpression' at all. | |
| 395 int get left() => JSPrecedence.CALL_PRECEDENCE; | |
| 396 int get right() => JSPrecedence.ASSIGNMENT_PRECEDENCE; | |
| 397 int get precedence() => JSPrecedence.ASSIGNMENT_PRECEDENCE; | |
| 398 } | |
| OLD | NEW |