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

Side by Side Diff: vm/flow_graph_builder.cc

Issue 11519006: Add read only handles for the following predefined symbols (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 #include "vm/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/code_descriptors.h" 8 #include "vm/code_descriptors.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 2361
2362 void ValueGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { 2362 void ValueGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) {
2363 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded)); 2363 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded));
2364 } 2364 }
2365 2365
2366 2366
2367 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { 2367 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
2368 Function* super_function = NULL; 2368 Function* super_function = NULL;
2369 if (node->IsSuperLoad()) { 2369 if (node->IsSuperLoad()) {
2370 // Resolve the load indexed operator in the super class. 2370 // Resolve the load indexed operator in the super class.
2371 const String& index_operator_name =
2372 String::ZoneHandle(Symbols::IndexToken());
2373 super_function = &Function::ZoneHandle( 2371 super_function = &Function::ZoneHandle(
2374 Resolver::ResolveDynamicAnyArgs(node->super_class(), 2372 Resolver::ResolveDynamicAnyArgs(node->super_class(),
2375 index_operator_name)); 2373 Symbols::IndexTokenHandle()));
2376 if (super_function->IsNull()) { 2374 if (super_function->IsNull()) {
2377 // Could not resolve super operator. Generate call noSuchMethod() of the 2375 // Could not resolve super operator. Generate call noSuchMethod() of the
2378 // super class instead. 2376 // super class instead.
2379 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); 2377 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
2380 arguments->Add(node->index_expr()); 2378 arguments->Add(node->index_expr());
2381 StaticCallInstr* call = 2379 StaticCallInstr* call =
2382 BuildStaticNoSuchMethodCall(node->super_class(), 2380 BuildStaticNoSuchMethodCall(node->super_class(),
2383 node->array(), 2381 node->array(),
2384 index_operator_name, 2382 Symbols::IndexTokenHandle(),
2385 arguments); 2383 arguments);
2386 ReturnDefinition(call); 2384 ReturnDefinition(call);
2387 return; 2385 return;
2388 } 2386 }
2389 } 2387 }
2390 ZoneGrowableArray<PushArgumentInstr*>* arguments = 2388 ZoneGrowableArray<PushArgumentInstr*>* arguments =
2391 new ZoneGrowableArray<PushArgumentInstr*>(2); 2389 new ZoneGrowableArray<PushArgumentInstr*>(2);
2392 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth()); 2390 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth());
2393 node->array()->Visit(&for_array); 2391 node->array()->Visit(&for_array);
2394 Append(for_array); 2392 Append(for_array);
2395 arguments->Add(PushArgument(for_array.value())); 2393 arguments->Add(PushArgument(for_array.value()));
2396 2394
2397 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth()); 2395 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth());
2398 node->index_expr()->Visit(&for_index); 2396 node->index_expr()->Visit(&for_index);
2399 Append(for_index); 2397 Append(for_index);
2400 arguments->Add(PushArgument(for_index.value())); 2398 arguments->Add(PushArgument(for_index.value()));
2401 2399
2402 if (super_function != NULL) { 2400 if (super_function != NULL) {
2403 // Generate static call to super operator. 2401 // Generate static call to super operator.
2404 StaticCallInstr* load = new StaticCallInstr(node->token_pos(), 2402 StaticCallInstr* load = new StaticCallInstr(node->token_pos(),
2405 *super_function, 2403 *super_function,
2406 Array::ZoneHandle(), 2404 Array::ZoneHandle(),
2407 arguments); 2405 arguments);
2408 ReturnDefinition(load); 2406 ReturnDefinition(load);
2409 } else { 2407 } else {
2410 // Generate dynamic call to index operator. 2408 // Generate dynamic call to index operator.
2411 const intptr_t checked_argument_count = 1; 2409 const intptr_t checked_argument_count = 1;
2412 const String& name = String::ZoneHandle(Symbols::IndexToken());
2413 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(), 2410 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(),
2414 name, 2411 Symbols::IndexTokenHandle(),
2415 Token::kINDEX, 2412 Token::kINDEX,
2416 arguments, 2413 arguments,
2417 Array::ZoneHandle(), 2414 Array::ZoneHandle(),
2418 checked_argument_count); 2415 checked_argument_count);
2419 ReturnDefinition(load); 2416 ReturnDefinition(load);
2420 } 2417 }
2421 } 2418 }
2422 2419
2423 2420
2424 Definition* EffectGraphVisitor::BuildStoreIndexedValues( 2421 Definition* EffectGraphVisitor::BuildStoreIndexedValues(
2425 StoreIndexedNode* node, 2422 StoreIndexedNode* node,
2426 bool result_is_needed) { 2423 bool result_is_needed) {
2427 Function* super_function = NULL; 2424 Function* super_function = NULL;
2428 if (node->IsSuperStore()) { 2425 if (node->IsSuperStore()) {
2429 // Resolve the store indexed operator in the super class. 2426 // Resolve the store indexed operator in the super class.
2430 const String& store_index_op_name =
2431 String::ZoneHandle(Symbols::AssignIndexToken());
2432 super_function = &Function::ZoneHandle( 2427 super_function = &Function::ZoneHandle(
2433 Resolver::ResolveDynamicAnyArgs(node->super_class(), 2428 Resolver::ResolveDynamicAnyArgs(node->super_class(),
2434 store_index_op_name)); 2429 Symbols::AssignIndexTokenHandle()));
2435 if (super_function->IsNull()) { 2430 if (super_function->IsNull()) {
2436 // Could not resolve super operator. Generate call noSuchMethod() of the 2431 // Could not resolve super operator. Generate call noSuchMethod() of the
2437 // super class instead. 2432 // super class instead.
2438 if (result_is_needed) { 2433 if (result_is_needed) {
2439 // Even though noSuchMethod most likely does not return, 2434 // Even though noSuchMethod most likely does not return,
2440 // we save the stored value if the result is needed. 2435 // we save the stored value if the result is needed.
2441 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth()); 2436 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth());
2442 node->value()->Visit(&for_value); 2437 node->value()->Visit(&for_value);
2443 Append(for_value); 2438 Append(for_value);
2444 Bind(BuildStoreExprTemp(for_value.value())); 2439 Bind(BuildStoreExprTemp(for_value.value()));
2445 } 2440 }
2446 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); 2441 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
2447 arguments->Add(node->index_expr()); 2442 arguments->Add(node->index_expr());
2448 arguments->Add(node->value()); 2443 arguments->Add(node->value());
2449 StaticCallInstr* call = 2444 StaticCallInstr* call =
2450 BuildStaticNoSuchMethodCall(node->super_class(), 2445 BuildStaticNoSuchMethodCall(node->super_class(),
2451 node->array(), 2446 node->array(),
2452 store_index_op_name, 2447 Symbols::AssignIndexTokenHandle(),
2453 arguments); 2448 arguments);
2454 if (result_is_needed) { 2449 if (result_is_needed) {
2455 Do(call); 2450 Do(call);
2456 return BuildLoadExprTemp(); 2451 return BuildLoadExprTemp();
2457 } else { 2452 } else {
2458 return call; 2453 return call;
2459 } 2454 }
2460 } 2455 }
2461 } 2456 }
2462 2457
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2955 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2961 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2956 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2962 OS::SNPrint(chars, len, kFormat, function_name, reason); 2957 OS::SNPrint(chars, len, kFormat, function_name, reason);
2963 const Error& error = Error::Handle( 2958 const Error& error = Error::Handle(
2964 LanguageError::New(String::Handle(String::New(chars)))); 2959 LanguageError::New(String::Handle(String::New(chars))));
2965 Isolate::Current()->long_jump_base()->Jump(1, error); 2960 Isolate::Current()->long_jump_base()->Jump(1, error);
2966 } 2961 }
2967 2962
2968 2963
2969 } // namespace dart 2964 } // namespace dart
OLDNEW
« vm/ast.h ('K') | « vm/dart_entry.cc ('k') | vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698