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

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

Issue 10905233: Whenever possible use length passed to the List constructor for bounds checks instead of loading it… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Srdjan's comments 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 | « no previous file | runtime/vm/intermediate_language.h » ('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 #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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 node->type_arguments())); 1680 node->type_arguments()));
1681 arguments->Add(push_type_arguments); 1681 arguments->Add(push_type_arguments);
1682 ASSERT(arguments->length() == 1); 1682 ASSERT(arguments->length() == 1);
1683 BuildPushArguments(*node->arguments(), arguments); 1683 BuildPushArguments(*node->arguments(), arguments);
1684 StaticCallInstr* call = 1684 StaticCallInstr* call =
1685 new StaticCallInstr(node->token_pos(), 1685 new StaticCallInstr(node->token_pos(),
1686 node->constructor(), 1686 node->constructor(),
1687 node->arguments()->names(), 1687 node->arguments()->names(),
1688 arguments); 1688 arguments);
1689 // List factories return kArrayCid or kGrowableObjectArrayCid. 1689 // List factories return kArrayCid or kGrowableObjectArrayCid.
1690 call->set_result_cid(GetResultCidOfConstructor(node)); 1690 const intptr_t result_cid = GetResultCidOfConstructor(node);
1691 call->set_result_cid(result_cid);
1692 call->set_is_known_constructor(result_cid != kDynamicCid);
1691 ReturnDefinition(call); 1693 ReturnDefinition(call);
1692 return; 1694 return;
1693 } 1695 }
1694 // t_n contains the allocated and initialized object. 1696 // t_n contains the allocated and initialized object.
1695 // t_n <- AllocateObject(class) 1697 // t_n <- AllocateObject(class)
1696 // t_n+1 <- ctor-arg 1698 // t_n+1 <- ctor-arg
1697 // t_n+2... <- constructor arguments start here 1699 // t_n+2... <- constructor arguments start here
1698 // StaticCall(constructor, t_n+1, t_n+2, ...) 1700 // StaticCall(constructor, t_n+1, t_n+2, ...)
1699 // No need to preserve allocated value (simpler than in ValueGraphVisitor). 1701 // No need to preserve allocated value (simpler than in ValueGraphVisitor).
1700 Value* allocated_value = BuildObjectAllocation(node); 1702 Value* allocated_value = BuildObjectAllocation(node);
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2632 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2631 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2633 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2632 OS::SNPrint(chars, len, kFormat, function_name, reason); 2634 OS::SNPrint(chars, len, kFormat, function_name, reason);
2633 const Error& error = Error::Handle( 2635 const Error& error = Error::Handle(
2634 LanguageError::New(String::Handle(String::New(chars)))); 2636 LanguageError::New(String::Handle(String::New(chars))));
2635 Isolate::Current()->long_jump_base()->Jump(1, error); 2637 Isolate::Current()->long_jump_base()->Jump(1, error);
2636 } 2638 }
2637 2639
2638 2640
2639 } // namespace dart 2641 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698