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

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10908291: Reapply "Remove Object.dynamic." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/lib/interceptors.dart ('k') | lib/core/object.dart » ('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 (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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 inputs.add(closureTarget); 2391 inputs.add(closureTarget);
2392 addDynamicSendArgumentsToList(node, inputs); 2392 addDynamicSendArgumentsToList(node, inputs);
2393 pushWithPosition(new HInvokeClosure(selector, inputs), node); 2393 pushWithPosition(new HInvokeClosure(selector, inputs), node);
2394 } 2394 }
2395 2395
2396 void handleForeignJs(Send node) { 2396 void handleForeignJs(Send node) {
2397 Link<Node> link = node.arguments; 2397 Link<Node> link = node.arguments;
2398 // If the invoke is on foreign code, don't visit the first 2398 // If the invoke is on foreign code, don't visit the first
2399 // argument, which is the type, and the second argument, 2399 // argument, which is the type, and the second argument,
2400 // which is the foreign code. 2400 // which is the foreign code.
2401 if (link.isEmpty() || link.isEmpty()) { 2401 if (link.isEmpty() || link.tail.isEmpty()) {
2402 compiler.cancel('At least two arguments expected', 2402 compiler.cancel('At least two arguments expected',
2403 node: node.argumentsNode); 2403 node: node.argumentsNode);
2404 } 2404 }
2405 link = link.tail.tail;
2406 List<HInstruction> inputs = <HInstruction>[]; 2405 List<HInstruction> inputs = <HInstruction>[];
2407 addGenericSendArgumentsToList(link, inputs); 2406 Node type = link.head;
2408 Node type = node.arguments.head; 2407 Node code = link.tail.head;
2409 Node literal = node.arguments.tail.head; 2408 addGenericSendArgumentsToList(link.tail.tail, inputs);
2410 if (literal is !StringNode || literal.dynamic.isInterpolation) { 2409
2411 compiler.cancel('JS code must be a string literal', node: literal); 2410 if (type is !LiteralString) {
2411 // The type must not be a juxtaposition or interpolation.
2412 compiler.cancel('The type of a JS expression must be a string literal',
2413 node: type);
2412 } 2414 }
2413 if (type is !LiteralString) { 2415 LiteralString typeString = type;
2414 compiler.cancel( 2416
2415 'The type of a JS expression must be a string literal', node: type); 2417 if (code is StringNode) {
2418 StringNode codeString = code;
2419 if (!codeString.isInterpolation) {
2420 // codeString may not be an interpolation, but may be a juxtaposition.
2421 push(new HForeign(codeString.dartString,
2422 typeString.dartString,
2423 inputs));
2424 return;
2425 }
2416 } 2426 }
2417 push(new HForeign( 2427 compiler.cancel('JS code must be a string literal', node: literal);
2418 literal.dynamic.dartString, type.dynamic.dartString, inputs));
2419 } 2428 }
2420 2429
2421 void handleForeignUnintercepted(Send node) { 2430 void handleForeignUnintercepted(Send node) {
2422 Link<Node> link = node.arguments; 2431 Link<Node> link = node.arguments;
2423 if (!link.tail.isEmpty()) { 2432 if (!link.tail.isEmpty()) {
2424 compiler.cancel( 2433 compiler.cancel(
2425 'More than one expression in UNINTERCEPTED()', node: node); 2434 'More than one expression in UNINTERCEPTED()', node: node);
2426 } 2435 }
2427 Expression expression = link.head; 2436 Expression expression = link.head;
2428 disableMethodInterception(); 2437 disableMethodInterception();
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 new HSubGraphBlockInformation(elseBranch.graph)); 4199 new HSubGraphBlockInformation(elseBranch.graph));
4191 4200
4192 HBasicBlock conditionStartBlock = conditionBranch.block; 4201 HBasicBlock conditionStartBlock = conditionBranch.block;
4193 conditionStartBlock.setBlockFlow(info, joinBlock); 4202 conditionStartBlock.setBlockFlow(info, joinBlock);
4194 SubGraph conditionGraph = conditionBranch.graph; 4203 SubGraph conditionGraph = conditionBranch.graph;
4195 HIf branch = conditionGraph.end.last; 4204 HIf branch = conditionGraph.end.last;
4196 assert(branch is HIf); 4205 assert(branch is HIf);
4197 branch.blockInformation = conditionStartBlock.blockFlow; 4206 branch.blockInformation = conditionStartBlock.blockFlow;
4198 } 4207 }
4199 } 4208 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/lib/interceptors.dart ('k') | lib/core/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698