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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart

Issue 614993002: Rename Constant to ConstantValue and ConstExp to ConstantExpression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * [InvokeDynamicSpecializer] and its subclasses are helpers to 8 * [InvokeDynamicSpecializer] and its subclasses are helpers to
9 * optimize intercepted dynamic calls. It knows what input types 9 * optimize intercepted dynamic calls. It knows what input types
10 * would be beneficial for performance, and how to change a invoke 10 * would be beneficial for performance, and how to change a invoke
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 if (inputsArePositiveIntegers(instruction, compiler)) { 362 if (inputsArePositiveIntegers(instruction, compiler)) {
363 JavaScriptBackend backend = compiler.backend; 363 JavaScriptBackend backend = compiler.backend;
364 return backend.positiveIntType; 364 return backend.positiveIntType;
365 } 365 }
366 return super.computeTypeFromInputTypes(instruction, compiler); 366 return super.computeTypeFromInputTypes(instruction, compiler);
367 } 367 }
368 368
369 bool isNotZero(HInstruction instruction, Compiler compiler) { 369 bool isNotZero(HInstruction instruction, Compiler compiler) {
370 if (!instruction.isConstantInteger()) return false; 370 if (!instruction.isConstantInteger()) return false;
371 HConstant rightConstant = instruction; 371 HConstant rightConstant = instruction;
372 IntConstant intConstant = rightConstant.constant; 372 IntConstantValue intConstant = rightConstant.constant;
373 int count = intConstant.value; 373 int count = intConstant.primitiveValue;
374 return count != 0; 374 return count != 0;
375 } 375 }
376 376
377 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, 377 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
378 Compiler compiler) { 378 Compiler compiler) {
379 HInstruction left = instruction.inputs[1]; 379 HInstruction left = instruction.inputs[1];
380 HInstruction right = instruction.inputs[2]; 380 HInstruction right = instruction.inputs[2];
381 if (isBuiltin(instruction, compiler)) { 381 if (isBuiltin(instruction, compiler)) {
382 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) { 382 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) {
383 if (left.isUInt31(compiler)) { 383 if (left.isUInt31(compiler)) {
(...skipping 28 matching lines...) Expand all
412 JavaScriptBackend backend = compiler.backend; 412 JavaScriptBackend backend = compiler.backend;
413 if (left.isPrimitiveOrNull(compiler)) { 413 if (left.isPrimitiveOrNull(compiler)) {
414 return backend.uint32Type; 414 return backend.uint32Type;
415 } 415 }
416 return super.computeTypeFromInputTypes(instruction, compiler); 416 return super.computeTypeFromInputTypes(instruction, compiler);
417 } 417 }
418 418
419 bool argumentLessThan32(HInstruction instruction) { 419 bool argumentLessThan32(HInstruction instruction) {
420 if (!instruction.isConstantInteger()) return false; 420 if (!instruction.isConstantInteger()) return false;
421 HConstant rightConstant = instruction; 421 HConstant rightConstant = instruction;
422 IntConstant intConstant = rightConstant.constant; 422 IntConstantValue intConstant = rightConstant.constant;
423 int count = intConstant.value; 423 int count = intConstant.primitiveValue;
424 return count >= 0 && count <= 31; 424 return count >= 0 && count <= 31;
425 } 425 }
426 426
427 bool isPositive(HInstruction instruction, Compiler compiler) { 427 bool isPositive(HInstruction instruction, Compiler compiler) {
428 // TODO: We should use the value range analysis. Currently, ranges 428 // TODO: We should use the value range analysis. Currently, ranges
429 // are discarded just after the analysis. 429 // are discarded just after the analysis.
430 return instruction.isPositiveInteger(compiler); 430 return instruction.isPositiveInteger(compiler);
431 } 431 }
432 } 432 }
433 433
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 } 719 }
720 720
721 HInstruction newBuiltinVariant(HInvokeDynamic instruction, 721 HInstruction newBuiltinVariant(HInvokeDynamic instruction,
722 Compiler compiler) { 722 Compiler compiler) {
723 JavaScriptBackend backend = compiler.backend; 723 JavaScriptBackend backend = compiler.backend;
724 return new HLessEqual( 724 return new HLessEqual(
725 instruction.inputs[1], instruction.inputs[2], 725 instruction.inputs[1], instruction.inputs[2],
726 instruction.selector, backend.boolType); 726 instruction.selector, backend.boolType);
727 } 727 }
728 } 728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698