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

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

Issue 11858017: Nice messages on uncaught exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments and fix a type error Created 7 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 | Annotate | Revision Log
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | no next file » | 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3061 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 'Isolate library and compiler mismatch', node: node); 3072 'Isolate library and compiler mismatch', node: node);
3073 } 3073 }
3074 HStatic target = new HStatic(element); 3074 HStatic target = new HStatic(element);
3075 add(target); 3075 add(target);
3076 List<HInstruction> inputs = <HInstruction>[target]; 3076 List<HInstruction> inputs = <HInstruction>[target];
3077 addGenericSendArgumentsToList(link, inputs); 3077 addGenericSendArgumentsToList(link, inputs);
3078 push(new HInvokeStatic(inputs)); 3078 push(new HInvokeStatic(inputs));
3079 } 3079 }
3080 } 3080 }
3081 3081
3082 void handleForeignDartClosureToJs(Send node) { 3082 FunctionSignature handleForeignRawFunctionRef(Send node, String name) {
ahe 2013/01/15 10:34:30 Found a type error during testing.
3083 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { 3083 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
3084 compiler.cancel('Exactly one argument required', 3084 compiler.cancel('$name requires exactly one argument',
3085 node: node.argumentsNode); 3085 node: node.argumentsNode);
3086 } 3086 }
3087 Node closure = node.arguments.head; 3087 Node closure = node.arguments.head;
3088 Element element = elements[closure]; 3088 Element element = elements[closure];
3089 if (!Elements.isStaticOrTopLevelFunction(element)) { 3089 if (!Elements.isStaticOrTopLevelFunction(element)) {
3090 compiler.cancel( 3090 compiler.cancel(
3091 'JS_TO_CLOSURE requires a static or top-level method', 3091 '$name requires a static or top-level method',
3092 node: closure); 3092 node: closure);
3093 } 3093 }
3094 FunctionElement function = element; 3094 FunctionElement function = element;
3095 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration 3095 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration
3096 // and implementation signatures. Currently it is need because the 3096 // and implementation signatures. Currently it is need because the
3097 // signatures have different elements for parameters. 3097 // signatures have different elements for parameters.
3098 FunctionElement implementation = function.implementation; 3098 FunctionElement implementation = function.implementation;
3099 FunctionSignature params = implementation.computeSignature(compiler); 3099 FunctionSignature params = implementation.computeSignature(compiler);
3100 if (params.optionalParameterCount != 0) { 3100 if (params.optionalParameterCount != 0) {
3101 compiler.cancel( 3101 compiler.cancel(
3102 'JS_TO_CLOSURE does not handle closure with optional parameters', 3102 '$name does not handle closure with optional parameters',
3103 node: closure); 3103 node: closure);
3104 } 3104 }
3105 visit(closure); 3105 visit(closure);
3106 return params;
3107 }
3108
3109 void handleForeignDartClosureToJs(Send node, String name) {
3110 FunctionSignature params = handleForeignRawFunctionRef(node, name);
3106 List<HInstruction> inputs = <HInstruction>[pop()]; 3111 List<HInstruction> inputs = <HInstruction>[pop()];
3107 String invocationName = backend.namer.closureInvocationName( 3112 String invocationName = backend.namer.closureInvocationName(
3108 new Selector.callClosure(params.requiredParameterCount)); 3113 new Selector.callClosure(params.requiredParameterCount));
3109 push(new HForeign(new DartString.literal('#.$invocationName'), 3114 push(new HForeign(new DartString.literal('#.$invocationName'),
3110 const LiteralDartString('var'), 3115 const LiteralDartString('var'),
3111 inputs)); 3116 inputs));
3112 } 3117 }
3113 3118
3114 void handleForeignSetCurrentIsolate(Send node) { 3119 void handleForeignSetCurrentIsolate(Send node) {
3115 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { 3120 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
(...skipping 25 matching lines...) Expand all
3141 handleForeignJs(node); 3146 handleForeignJs(node);
3142 } else if (name == const SourceString('UNINTERCEPTED')) { 3147 } else if (name == const SourceString('UNINTERCEPTED')) {
3143 handleForeignUnintercepted(node); 3148 handleForeignUnintercepted(node);
3144 } else if (name == const SourceString('JS_HAS_EQUALS')) { 3149 } else if (name == const SourceString('JS_HAS_EQUALS')) {
3145 handleForeignJsHasEquals(node); 3150 handleForeignJsHasEquals(node);
3146 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { 3151 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) {
3147 handleForeignJsCurrentIsolate(node); 3152 handleForeignJsCurrentIsolate(node);
3148 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { 3153 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) {
3149 handleForeignJsCallInIsolate(node); 3154 handleForeignJsCallInIsolate(node);
3150 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { 3155 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) {
3151 handleForeignDartClosureToJs(node); 3156 handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS');
3157 } else if (name == const SourceString('RAW_DART_FUNCTION_REF')) {
3158 handleForeignRawFunctionRef(node, 'RAW_DART_FUNCTION_REF');
3152 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) { 3159 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) {
3153 handleForeignSetCurrentIsolate(node); 3160 handleForeignSetCurrentIsolate(node);
3154 } else if (name == const SourceString('JS_CREATE_ISOLATE')) { 3161 } else if (name == const SourceString('JS_CREATE_ISOLATE')) {
3155 handleForeignCreateIsolate(node); 3162 handleForeignCreateIsolate(node);
3156 } else { 3163 } else {
3157 throw "Unknown foreign: ${selector}"; 3164 throw "Unknown foreign: ${selector}";
3158 } 3165 }
3159 } 3166 }
3160 3167
3161 generateSuperNoSuchMethodSend(Send node) { 3168 generateSuperNoSuchMethodSend(Send node) {
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
5101 new HSubGraphBlockInformation(elseBranch.graph)); 5108 new HSubGraphBlockInformation(elseBranch.graph));
5102 5109
5103 HBasicBlock conditionStartBlock = conditionBranch.block; 5110 HBasicBlock conditionStartBlock = conditionBranch.block;
5104 conditionStartBlock.setBlockFlow(info, joinBlock); 5111 conditionStartBlock.setBlockFlow(info, joinBlock);
5105 SubGraph conditionGraph = conditionBranch.graph; 5112 SubGraph conditionGraph = conditionBranch.graph;
5106 HIf branch = conditionGraph.end.last; 5113 HIf branch = conditionGraph.end.last;
5107 assert(branch is HIf); 5114 assert(branch is HIf);
5108 branch.blockInformation = conditionStartBlock.blockFlow; 5115 branch.blockInformation = conditionStartBlock.blockFlow;
5109 } 5116 }
5110 } 5117 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698