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

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

Issue 10511008: Support overriding fields with fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 6 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) 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 element: element); 388 element: element);
389 } 389 }
390 return directLocals[element]; 390 return directLocals[element];
391 } else if (isStoredInClosureField(element)) { 391 } else if (isStoredInClosureField(element)) {
392 Element redirect = redirectionMapping[element]; 392 Element redirect = redirectionMapping[element];
393 // We must not use the [LocalsHandler.readThis()] since that could 393 // We must not use the [LocalsHandler.readThis()] since that could
394 // point to a captured this which would be stored in a closure-field 394 // point to a captured this which would be stored in a closure-field
395 // itself. 395 // itself.
396 HInstruction receiver = new HThis(); 396 HInstruction receiver = new HThis();
397 builder.add(receiver); 397 builder.add(receiver);
398 HInstruction fieldGet = new HFieldGet(redirect.name, receiver); 398 HInstruction fieldGet = new HFieldGet(redirect, receiver);
399 builder.add(fieldGet); 399 builder.add(fieldGet);
400 return fieldGet; 400 return fieldGet;
401 } else if (isBoxed(element)) { 401 } else if (isBoxed(element)) {
402 Element redirect = redirectionMapping[element]; 402 Element redirect = redirectionMapping[element];
403 // In the function that declares the captured variable the box is 403 // In the function that declares the captured variable the box is
404 // accessed as direct local. Inside the nested closure the box is 404 // accessed as direct local. Inside the nested closure the box is
405 // accessed through a closure-field. 405 // accessed through a closure-field.
406 // Calling [readLocal] makes sure we generate the correct code to get 406 // Calling [readLocal] makes sure we generate the correct code to get
407 // the box. 407 // the box.
408 assert(redirect.enclosingElement.kind == ElementKind.VARIABLE); 408 assert(redirect.enclosingElement.kind == ElementKind.VARIABLE);
409 HInstruction box = readLocal(redirect.enclosingElement); 409 HInstruction box = readLocal(redirect.enclosingElement);
410 HInstruction lookup = new HFieldGet(redirect.name, box); 410 HInstruction lookup = new HFieldGet(redirect, box);
411 builder.add(lookup); 411 builder.add(lookup);
412 return lookup; 412 return lookup;
413 } else { 413 } else {
414 assert(isUsedInTry(element)); 414 assert(isUsedInTry(element));
415 HParameterValue parameter = getActivationParameter(element); 415 HParameterValue parameter = getActivationParameter(element);
416 HInstruction variable = new HFieldGet.fromActivation(parameter); 416 HInstruction variable = new HFieldGet.fromActivation(parameter);
417 builder.add(variable); 417 builder.add(variable);
418 return variable; 418 return variable;
419 } 419 }
420 } 420 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 builder.add(receiver); 467 builder.add(receiver);
468 builder.add(new HFieldSet(redirect.name, receiver, value)); 468 builder.add(new HFieldSet(redirect.name, receiver, value));
469 } else if (isBoxed(element)) { 469 } else if (isBoxed(element)) {
470 Element redirect = redirectionMapping[element]; 470 Element redirect = redirectionMapping[element];
471 // The box itself could be captured, or be local. A local variable that 471 // The box itself could be captured, or be local. A local variable that
472 // is captured will be boxed, but the box itself will be a local. 472 // is captured will be boxed, but the box itself will be a local.
473 // Inside the closure the box is stored in a closure-field and cannot 473 // Inside the closure the box is stored in a closure-field and cannot
474 // be accessed directly. 474 // be accessed directly.
475 assert(redirect.enclosingElement.kind == ElementKind.VARIABLE); 475 assert(redirect.enclosingElement.kind == ElementKind.VARIABLE);
476 HInstruction box = readLocal(redirect.enclosingElement); 476 HInstruction box = readLocal(redirect.enclosingElement);
477 builder.add(new HFieldSet(redirect.name, box, value)); 477 builder.add(new HFieldSet(redirect, box, value));
478 } else { 478 } else {
479 assert(isUsedInTry(element)); 479 assert(isUsedInTry(element));
480 HParameterValue parameter = getActivationParameter(element); 480 HParameterValue parameter = getActivationParameter(element);
481 builder.add(new HFieldSet.fromActivation(parameter, value)); 481 builder.add(new HFieldSet.fromActivation(parameter, value));
482 } 482 }
483 } 483 }
484 484
485 /** 485 /**
486 * This function must be called before visiting any children of the loop. In 486 * This function must be called before visiting any children of the loop. In
487 * particular it needs to be called before executing the initializers. 487 * particular it needs to be called before executing the initializers.
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
3413 <HInstruction>[target, input], 3413 <HInstruction>[target, input],
3414 HType.STRING)); 3414 HType.STRING));
3415 return builder.pop(); 3415 return builder.pop();
3416 } 3416 }
3417 3417
3418 HInstruction result(Node node) { 3418 HInstruction result(Node node) {
3419 flushLiterals(node); 3419 flushLiterals(node);
3420 return prefix; 3420 return prefix;
3421 } 3421 }
3422 } 3422 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/namer.dart ('k') | dart/lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698