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

Side by Side Diff: runtime/vm/code_generator.cc

Issue 17675002: Correctly deal with method invocation of a getter. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | tests/language/method_invocation_test.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) 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 #include "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 getter.IsMethodExtractor() || 1162 getter.IsMethodExtractor() ||
1163 getter.IsNoSuchMethodDispatcher()) { 1163 getter.IsNoSuchMethodDispatcher()) {
1164 return false; 1164 return false;
1165 } 1165 }
1166 1166
1167 // 2. Invoke the getter. 1167 // 2. Invoke the getter.
1168 const Array& args = Array::Handle(Array::New(kNumArguments)); 1168 const Array& args = Array::Handle(Array::New(kNumArguments));
1169 args.SetAt(0, receiver); 1169 args.SetAt(0, receiver);
1170 const Object& value = Object::Handle(DartEntry::InvokeFunction(getter, args)); 1170 const Object& value = Object::Handle(DartEntry::InvokeFunction(getter, args));
1171 1171
1172 // 3. If the getter threw an exception, treat it as no such method. 1172 // 3. If there was some error, propagate it.
1173 if (value.IsUnhandledException()) return false;
1174
1175 // 4. If there was some other error, propagate it.
1176 CheckResultError(value); 1173 CheckResultError(value);
1177 1174
1178 // 5. Invoke the value as a closure. 1175 // 4. Invoke the value as a closure.
1179 Instance& instance = Instance::Handle(); 1176 Instance& instance = Instance::Handle();
1180 instance ^= value.raw(); 1177 instance ^= value.raw();
1181 arguments.SetAt(0, instance); 1178 arguments.SetAt(0, instance);
1182 *result = DartEntry::InvokeClosure(arguments, arguments_descriptor); 1179 *result = DartEntry::InvokeClosure(arguments, arguments_descriptor);
1183 CheckResultError(*result); 1180 CheckResultError(*result);
1184 return true; 1181 return true;
1185 } 1182 }
1186 1183
1187 1184
1188 // Create a method for noSuchMethod invocation and attach it to the receiver 1185 // Create a method for noSuchMethod invocation and attach it to the receiver
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 // Arg1: Value that is being stored. 1868 // Arg1: Value that is being stored.
1872 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1869 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1873 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); 1870 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
1874 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1871 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1875 const Object& value = Object::Handle(arguments.ArgAt(1)); 1872 const Object& value = Object::Handle(arguments.ArgAt(1));
1876 1873
1877 field.UpdateCid(value.GetClassId()); 1874 field.UpdateCid(value.GetClassId());
1878 } 1875 }
1879 1876
1880 } // namespace dart 1877 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/method_invocation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698