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

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

Issue 14366007: Handle built-in function identical correctly (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/parser.cc » ('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 "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 return kDynamicCid; // Unknown. 1922 return kDynamicCid; // Unknown.
1923 } 1923 }
1924 } 1924 }
1925 return kDynamicCid; 1925 return kDynamicCid;
1926 } 1926 }
1927 1927
1928 1928
1929 // <Expression> ::= StaticCall { function: Function 1929 // <Expression> ::= StaticCall { function: Function
1930 // arguments: <ArgumentList> } 1930 // arguments: <ArgumentList> }
1931 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { 1931 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
1932 if (node->function().name() == Symbols::Identical().raw()) {
1933 // Attempt to replace top level defined 'identical' from the core
1934 // library with strict equal early on.
1935 // TODO(hausner): Evaluate if this can happen at AST building time.
1936 const Class& cls = Class::Handle(node->function().Owner());
1937 if (cls.IsTopLevel()) {
1938 const Library& core_lib = Library::Handle(Library::CoreLibrary());
1939 if (cls.library() == core_lib.raw()) {
1940 ASSERT(node->arguments()->length() == 2);
1941 ValueGraphVisitor for_left_value(owner(), temp_index());
1942 node->arguments()->NodeAt(0)->Visit(&for_left_value);
1943 Append(for_left_value);
1944 ValueGraphVisitor for_right_value(owner(), temp_index());
1945 node->arguments()->NodeAt(1)->Visit(&for_right_value);
1946 Append(for_right_value);
1947 StrictCompareInstr* comp = new StrictCompareInstr(
1948 Token::kEQ_STRICT,
1949 for_left_value.value(),
1950 for_right_value.value());
1951 ReturnDefinition(comp);
1952 return;
1953 }
1954 }
1955 }
1956 ZoneGrowableArray<PushArgumentInstr*>* arguments = 1932 ZoneGrowableArray<PushArgumentInstr*>* arguments =
1957 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length()); 1933 new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
1958 BuildPushArguments(*node->arguments(), arguments); 1934 BuildPushArguments(*node->arguments(), arguments);
1959 StaticCallInstr* call = 1935 StaticCallInstr* call =
1960 new StaticCallInstr(node->token_pos(), 1936 new StaticCallInstr(node->token_pos(),
1961 node->function(), 1937 node->function(),
1962 node->arguments()->names(), 1938 node->arguments()->names(),
1963 arguments); 1939 arguments);
1964 if (node->function().is_native()) { 1940 if (node->function().is_native()) {
1965 const intptr_t result_cid = GetResultCidOfNative(node->function()); 1941 const intptr_t result_cid = GetResultCidOfNative(node->function());
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
3404 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3380 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3405 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3381 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3406 OS::SNPrint(chars, len, kFormat, function_name, reason); 3382 OS::SNPrint(chars, len, kFormat, function_name, reason);
3407 const Error& error = Error::Handle( 3383 const Error& error = Error::Handle(
3408 LanguageError::New(String::Handle(String::New(chars)))); 3384 LanguageError::New(String::Handle(String::New(chars))));
3409 Isolate::Current()->long_jump_base()->Jump(1, error); 3385 Isolate::Current()->long_jump_base()->Jump(1, error);
3410 } 3386 }
3411 3387
3412 3388
3413 } // namespace dart 3389 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698