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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 22640019: Fix for running with --throw_on_javascript_int_overflow: recognize pattern (a << b) & mask and test… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 26120)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -983,12 +983,13 @@
arguments->Add(push_left);
arguments->Add(push_right);
const String& name = String::ZoneHandle(Symbols::New(node->Name()));
+ const intptr_t kNumArgsChecked = 2;
InstanceCallInstr* call = new InstanceCallInstr(node->token_pos(),
name,
node->kind(),
arguments,
Object::null_array(),
- 2,
+ kNumArgsChecked,
owner()->ic_data_array());
ReturnDefinition(call);
}
@@ -1044,6 +1045,54 @@
}
+static const String& BinaryOpAndMaskName(BinaryOpNode* node) {
+ if (node->kind() == Token::kSHL) {
+ return PrivateCoreLibName(Symbols::_leftShiftWithMask32());
+ }
+ UNIMPLEMENTED();
+ return String::ZoneHandle();
+}
+
+
+// <Expression> :: BinaryOp { kind: Token::Kind
+// left: <Expression>
+// right: <Expression>
+// mask32: constant }
+void EffectGraphVisitor::VisitBinaryOpWithMask32Node(
+ BinaryOpWithMask32Node* node) {
+ ASSERT((node->kind() != Token::kAND) && (node->kind() != Token::kOR));
+ ValueGraphVisitor for_left_value(owner(), temp_index());
+ node->left()->Visit(&for_left_value);
+ Append(for_left_value);
+ PushArgumentInstr* push_left = PushArgument(for_left_value.value());
+
+ ValueGraphVisitor for_right_value(owner(), temp_index());
+ node->right()->Visit(&for_right_value);
+ Append(for_right_value);
+ PushArgumentInstr* push_right = PushArgument(for_right_value.value());
+
+ Value* mask_value = Bind(new ConstantInstr(
+ Integer::ZoneHandle(Integer::New(node->mask32(), Heap::kOld))));
+ PushArgumentInstr* push_mask = PushArgument(mask_value);
+
+ ZoneGrowableArray<PushArgumentInstr*>* arguments =
+ new ZoneGrowableArray<PushArgumentInstr*>(3);
+ arguments->Add(push_left);
+ arguments->Add(push_right);
+ // Call to special method 'BinaryOpAndMaskName(node)'.
+ arguments->Add(push_mask);
+ const intptr_t kNumArgsChecked = 2;
+ InstanceCallInstr* call = new InstanceCallInstr(node->token_pos(),
+ BinaryOpAndMaskName(node),
+ Token::kILLEGAL,
+ arguments,
+ Object::null_array(),
+ kNumArgsChecked,
+ owner()->ic_data_array());
+ ReturnDefinition(call);
+}
+
+
void EffectGraphVisitor::BuildTypecheckPushArguments(
intptr_t token_pos,
PushArgumentInstr** push_instantiator_result,
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698