Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 new AssertAssignableComp(return_value, type); | 171 new AssertAssignableComp(return_value, type); |
| 172 AddInstruction(new BindInstr(temp_index(), assert)); | 172 AddInstruction(new BindInstr(temp_index(), assert)); |
| 173 return_value = new TempVal(temp_index()); | 173 return_value = new TempVal(temp_index()); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 AddInstruction(new ReturnInstr(return_value, node->token_index())); | 177 AddInstruction(new ReturnInstr(return_value, node->token_index())); |
| 178 CloseFragment(); | 178 CloseFragment(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void ValueGraphVisitor::VisitReturnNode(ReturnNode* node) { UNREACHABLE(); } | |
| 182 void TestGraphVisitor::VisitReturnNode(ReturnNode* node) { UNREACHABLE(); } | |
| 183 | |
| 184 | 181 |
| 185 // <Expression> ::= Literal { literal: Instance } | 182 // <Expression> ::= Literal { literal: Instance } |
| 186 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { | 183 void EffectGraphVisitor::VisitLiteralNode(LiteralNode* node) { |
| 187 return; | 184 return; |
| 188 } | 185 } |
| 189 | 186 |
| 190 void ValueGraphVisitor::VisitLiteralNode(LiteralNode* node) { | 187 void ValueGraphVisitor::VisitLiteralNode(LiteralNode* node) { |
| 191 ReturnValue(new ConstantVal(node->literal())); | 188 ReturnValue(new ConstantVal(node->literal())); |
| 192 } | 189 } |
| 193 | 190 |
| 194 void TestGraphVisitor::VisitLiteralNode(LiteralNode* node) { | 191 void TestGraphVisitor::VisitLiteralNode(LiteralNode* node) { |
| 195 BranchOnValue(new ConstantVal(node->literal())); | 192 BranchOnValue(new ConstantVal(node->literal())); |
| 196 } | 193 } |
| 197 | 194 |
| 198 | 195 |
| 199 // Type nodes only occur as the right-hand side of instanceof comparisons, | 196 // Type nodes only occur as the right-hand side of instanceof comparisons, |
| 200 // and they are handled specially in that context. | 197 // and they are handled specially in that context. |
| 201 void EffectGraphVisitor::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | 198 void EffectGraphVisitor::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } |
| 202 void ValueGraphVisitor::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | |
| 203 void TestGraphVisitor::VisitTypeNode(TypeNode* node) { UNREACHABLE(); } | |
| 204 | 199 |
| 205 | 200 |
| 206 // <Expression> :: Assignable { expr: <Expression> | 201 // <Expression> :: Assignable { expr: <Expression> |
| 207 // type: AbstractType | 202 // type: AbstractType |
| 208 // dst_name: String } | 203 // dst_name: String } |
| 209 AssertAssignableComp* EffectGraphVisitor::TranslateAssignable( | 204 void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) { |
| 210 const AssignableNode& node) { | |
| 211 ValueGraphVisitor for_value(owner(), temp_index()); | 205 ValueGraphVisitor for_value(owner(), temp_index()); |
| 212 node.expr()->Visit(&for_value); | 206 node->expr()->Visit(&for_value); |
| 213 Append(for_value); | 207 Append(for_value); |
| 214 CHECK_ALIVE(return NULL); | 208 CHECK_ALIVE(return); |
| 215 | 209 |
| 216 return new AssertAssignableComp(for_value.value(), node.type()); | 210 AssertAssignableComp* assert = |
| 217 } | 211 new AssertAssignableComp(for_value.value(), node->type()); |
| 218 | 212 ReturnComputation(assert); |
| 219 void EffectGraphVisitor::VisitAssignableNode(AssignableNode* node) { | |
| 220 AssertAssignableComp* assert = TranslateAssignable(*node); | |
| 221 CHECK_ALIVE(return); | |
| 222 DoComputation(assert); | |
| 223 } | |
| 224 | |
| 225 void ValueGraphVisitor::VisitAssignableNode(AssignableNode* node) { | |
| 226 AssertAssignableComp* assert = TranslateAssignable(*node); | |
| 227 CHECK_ALIVE(return); | |
| 228 ReturnValueOf(assert); | |
| 229 } | |
| 230 | |
| 231 | |
| 232 void TestGraphVisitor::VisitAssignableNode(AssignableNode* node) { | |
| 233 AssertAssignableComp* assert = TranslateAssignable(*node); | |
| 234 CHECK_ALIVE(return); | |
| 235 BranchOnValueOf(assert); | |
| 236 } | 213 } |
| 237 | 214 |
| 238 | 215 |
| 239 // <Expression> :: BinaryOp { kind: Token::Kind | 216 // <Expression> :: BinaryOp { kind: Token::Kind |
| 240 // left: <Expression> | 217 // left: <Expression> |
| 241 // right: <Expression> } | 218 // right: <Expression> } |
| 242 InstanceCallComp* EffectGraphVisitor::TranslateBinaryOp( | 219 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { |
| 243 const BinaryOpNode& node) { | |
| 244 // Operators "&&" and "||" cannot be overloaded therefore do not call | 220 // Operators "&&" and "||" cannot be overloaded therefore do not call |
| 245 // operator. | 221 // operator. |
| 246 if ((node.kind() == Token::kAND) || (node.kind() == Token::kOR)) { | 222 if ((node->kind() == Token::kAND) || (node->kind() == Token::kOR)) { |
| 247 Bailout("EffectGraphVisitor::VisitBinaryOpNode AND/OR"); | 223 Bailout("EffectGraphVisitor::VisitBinaryOpNode AND/OR"); |
| 248 } | 224 } |
| 249 ValueGraphVisitor for_left_value(owner(), temp_index()); | 225 ValueGraphVisitor for_left_value(owner(), temp_index()); |
| 250 node.left()->Visit(&for_left_value); | 226 node->left()->Visit(&for_left_value); |
| 251 Append(for_left_value); | 227 Append(for_left_value); |
| 252 CHECK_ALIVE(return NULL); | 228 CHECK_ALIVE(return); |
| 253 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); | 229 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); |
| 254 node.right()->Visit(&for_right_value); | 230 node->right()->Visit(&for_right_value); |
| 255 Append(for_right_value); | 231 Append(for_right_value); |
| 256 CHECK_ALIVE(return NULL); | 232 CHECK_ALIVE(return); |
| 257 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); | 233 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); |
| 258 arguments->Add(for_left_value.value()); | 234 arguments->Add(for_left_value.value()); |
| 259 arguments->Add(for_right_value.value()); | 235 arguments->Add(for_right_value.value()); |
| 260 return new InstanceCallComp(node.Name(), arguments); | 236 InstanceCallComp* call = new InstanceCallComp(node->Name(), arguments); |
| 261 } | 237 ReturnComputation(call); |
| 262 | |
| 263 void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { | |
| 264 InstanceCallComp* call = TranslateBinaryOp(*node); | |
| 265 CHECK_ALIVE(return); | |
| 266 DoComputation(call); | |
| 267 } | |
| 268 | |
| 269 void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { | |
| 270 InstanceCallComp* call = TranslateBinaryOp(*node); | |
| 271 CHECK_ALIVE(return); | |
| 272 ReturnValueOf(call); | |
| 273 } | |
| 274 | |
| 275 void TestGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { | |
| 276 InstanceCallComp* call = TranslateBinaryOp(*node); | |
| 277 CHECK_ALIVE(return); | |
| 278 BranchOnValueOf(call); | |
| 279 } | 238 } |
| 280 | 239 |
| 281 | 240 |
| 282 void EffectGraphVisitor::VisitStringConcatNode(StringConcatNode* node) { | 241 void EffectGraphVisitor::VisitStringConcatNode(StringConcatNode* node) { |
| 283 Bailout("EffectGraphVisitor::VisitStringConcatNode"); | 242 Bailout("EffectGraphVisitor::VisitStringConcatNode"); |
| 284 } | 243 } |
| 285 void ValueGraphVisitor::VisitStringConcatNode(StringConcatNode* node) { | |
| 286 Bailout("ValueGraphVisitor::VisitStringConcatNode"); | |
| 287 } | |
| 288 void TestGraphVisitor::VisitStringConcatNode(StringConcatNode* node) { | |
| 289 Bailout("TestGraphVisitor::VisitStringConcatNode"); | |
| 290 } | |
| 291 | 244 |
| 292 | 245 |
| 293 // <Expression> :: Comparison { kind: Token::Kind | 246 // <Expression> :: Comparison { kind: Token::Kind |
| 294 // left: <Expression> | 247 // left: <Expression> |
| 295 // right: <Expression> } | 248 // right: <Expression> } |
| 296 Computation* EffectGraphVisitor::TranslateComparison( | 249 void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) { |
| 297 const ComparisonNode& node) { | 250 if (Token::IsInstanceofOperator(node->kind())) { |
| 298 if (Token::IsInstanceofOperator(node.kind())) { | |
| 299 Bailout("instanceof not yet implemented"); | 251 Bailout("instanceof not yet implemented"); |
| 300 } else if ((node.kind() == Token::kEQ) || (node.kind() == Token::kNE)) { | 252 } else if ((node->kind() == Token::kEQ) || (node->kind() == Token::kNE)) { |
| 301 Bailout("'==' or '!=' comparison not yet implemented"); | 253 Bailout("'==' or '!=' comparison not yet implemented"); |
| 302 } | 254 } |
| 303 ValueGraphVisitor for_left_value(owner(), temp_index()); | 255 ValueGraphVisitor for_left_value(owner(), temp_index()); |
| 304 node.left()->Visit(&for_left_value); | 256 node->left()->Visit(&for_left_value); |
| 305 Append(for_left_value); | 257 Append(for_left_value); |
| 306 CHECK_ALIVE(return NULL); | 258 CHECK_ALIVE(return); |
| 307 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); | 259 ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index()); |
| 308 node.right()->Visit(&for_right_value); | 260 node->right()->Visit(&for_right_value); |
| 309 Append(for_right_value); | 261 Append(for_right_value); |
| 310 CHECK_ALIVE(return NULL); | 262 CHECK_ALIVE(return); |
| 311 if ((node.kind() == Token::kEQ_STRICT) || | 263 if ((node->kind() == Token::kEQ_STRICT) || |
| 312 (node.kind() == Token::kNE_STRICT)) { | 264 (node->kind() == Token::kNE_STRICT)) { |
| 313 return new StrictCompareComp( | 265 StrictCompareComp* comp = new StrictCompareComp( |
| 314 node.kind(), for_left_value.value(), for_right_value.value()); | 266 node->kind(), for_left_value.value(), for_right_value.value()); |
| 267 ReturnComputation(comp); | |
| 268 return; | |
| 315 } | 269 } |
| 316 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); | 270 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); |
| 317 arguments->Add(for_left_value.value()); | 271 arguments->Add(for_left_value.value()); |
| 318 arguments->Add(for_right_value.value()); | 272 arguments->Add(for_right_value.value()); |
| 319 return new InstanceCallComp(node.Name(), arguments); | 273 InstanceCallComp* call = new InstanceCallComp(node->Name(), arguments); |
| 320 } | 274 ReturnComputation(call); |
| 321 | |
| 322 void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) { | |
| 323 Computation* call = TranslateComparison(*node); | |
| 324 CHECK_ALIVE(return); | |
| 325 DoComputation(call); | |
| 326 } | |
| 327 | |
| 328 void ValueGraphVisitor::VisitComparisonNode(ComparisonNode* node) { | |
| 329 Computation* call = TranslateComparison(*node); | |
| 330 CHECK_ALIVE(return); | |
| 331 ReturnValueOf(call); | |
| 332 } | |
| 333 | |
| 334 void TestGraphVisitor::VisitComparisonNode(ComparisonNode* node) { | |
| 335 Computation* call = TranslateComparison(*node); | |
| 336 CHECK_ALIVE(return); | |
| 337 BranchOnValueOf(call); | |
| 338 } | |
| 339 | |
| 340 | |
| 341 | |
| 342 InstanceCallComp* EffectGraphVisitor::TranslateUnaryOp( | |
| 343 const UnaryOpNode& node) { | |
| 344 // "!" cannot be overloaded, therefore do not call operator. | |
| 345 if (node.kind() == Token::kNOT) { | |
| 346 Bailout("EffectGraphVisitor::VisitUnaryOpNode NOT"); | |
| 347 } | |
| 348 ValueGraphVisitor for_value(owner(), temp_index()); | |
| 349 node.operand()->Visit(&for_value); | |
| 350 Append(for_value); | |
| 351 ZoneGrowableArray<Value*>* argument = new ZoneGrowableArray<Value*>(1); | |
| 352 argument->Add(for_value.value()); | |
| 353 return new InstanceCallComp(node.Name(), argument); | |
| 354 } | 275 } |
| 355 | 276 |
| 356 | 277 |
| 357 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 278 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { |
| 358 InstanceCallComp* call = TranslateUnaryOp(*node); | 279 // "!" cannot be overloaded, therefore do not call operator. |
| 359 DoComputation(call); | 280 if (node->kind() == Token::kNOT) { |
| 360 } | 281 Bailout("EffectGraphVisitor::VisitUnaryOpNode NOT"); |
| 361 void ValueGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 282 } |
| 362 InstanceCallComp* call = TranslateUnaryOp(*node); | 283 ValueGraphVisitor for_value(owner(), temp_index()); |
| 363 ReturnValueOf(call); | 284 node->operand()->Visit(&for_value); |
| 364 } | 285 Append(for_value); |
| 365 void TestGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 286 ZoneGrowableArray<Value*>* argument = new ZoneGrowableArray<Value*>(1); |
| 366 InstanceCallComp* call = TranslateUnaryOp(*node); | 287 argument->Add(for_value.value()); |
| 367 BranchOnValueOf(call); | 288 InstanceCallComp* call = new InstanceCallComp(node->Name(), argument); |
| 289 ReturnComputation(call); | |
| 368 } | 290 } |
| 369 | 291 |
| 370 | 292 |
| 371 void EffectGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | 293 void EffectGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { |
| 372 Bailout("EffectGraphVisitor::VisitIncrOpLocalNode"); | 294 Bailout("EffectGraphVisitor::VisitIncrOpLocalNode"); |
| 373 } | 295 } |
| 374 void ValueGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
| 375 Bailout("ValueGraphVisitor::VisitIncrOpLocalNode"); | |
| 376 } | |
| 377 void TestGraphVisitor::VisitIncrOpLocalNode(IncrOpLocalNode* node) { | |
| 378 Bailout("TestGraphVisitor::VisitIncrOpLocalNode"); | |
| 379 } | |
| 380 | 296 |
| 381 | 297 |
| 382 void EffectGraphVisitor::VisitIncrOpInstanceFieldNode( | 298 void EffectGraphVisitor::VisitIncrOpInstanceFieldNode( |
| 383 IncrOpInstanceFieldNode* node) { | 299 IncrOpInstanceFieldNode* node) { |
| 384 Bailout("EffectGraphVisitor::VisitIncrOpInstanceFieldNode"); | 300 Bailout("EffectGraphVisitor::VisitIncrOpInstanceFieldNode"); |
| 385 } | 301 } |
| 386 void ValueGraphVisitor::VisitIncrOpInstanceFieldNode( | |
| 387 IncrOpInstanceFieldNode* node) { | |
| 388 Bailout("ValueGraphVisitor::VisitIncrOpInstanceFieldNode"); | |
| 389 } | |
| 390 void TestGraphVisitor::VisitIncrOpInstanceFieldNode( | |
| 391 IncrOpInstanceFieldNode* node) { | |
| 392 Bailout("TestGraphVisitor::VisitIncrOpInstanceFieldNode"); | |
| 393 } | |
| 394 | 302 |
| 395 | 303 |
| 396 void EffectGraphVisitor::VisitIncrOpStaticFieldNode( | 304 void EffectGraphVisitor::VisitIncrOpStaticFieldNode( |
| 397 IncrOpStaticFieldNode* node) { | 305 IncrOpStaticFieldNode* node) { |
| 398 Bailout("EffectGraphVisitor::VisitIncrOpStaticFieldNode"); | 306 Bailout("EffectGraphVisitor::VisitIncrOpStaticFieldNode"); |
| 399 } | 307 } |
| 400 void ValueGraphVisitor::VisitIncrOpStaticFieldNode( | |
| 401 IncrOpStaticFieldNode* node) { | |
| 402 Bailout("ValueGraphVisitor::VisitIncrOpStaticFieldNode"); | |
| 403 } | |
| 404 void TestGraphVisitor::VisitIncrOpStaticFieldNode(IncrOpStaticFieldNode* node) { | |
| 405 Bailout("TestGraphVisitor::VisitIncrOpStaticFieldNode"); | |
| 406 } | |
| 407 | 308 |
| 408 | 309 |
| 409 void EffectGraphVisitor::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | 310 void EffectGraphVisitor::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { |
| 410 Bailout("EffectGraphVisitor::VisitIncrOpIndexedNode"); | 311 Bailout("EffectGraphVisitor::VisitIncrOpIndexedNode"); |
| 411 } | 312 } |
| 412 void ValueGraphVisitor::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | |
| 413 Bailout("ValueGraphVisitor::VisitIncrOpIndexedNode"); | |
| 414 } | |
| 415 void TestGraphVisitor::VisitIncrOpIndexedNode(IncrOpIndexedNode* node) { | |
| 416 Bailout("TestGraphVisitor::VisitIncrOpIndexedNode"); | |
| 417 } | |
| 418 | 313 |
| 419 | 314 |
| 420 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { | 315 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { |
| 421 Bailout("EffectGraphVisitor::VisitConditionalExprNode"); | 316 Bailout("EffectGraphVisitor::VisitConditionalExprNode"); |
| 422 } | 317 } |
| 423 void ValueGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { | |
| 424 Bailout("ValueGraphVisitor::VisitConditionalExprNode"); | |
| 425 } | |
| 426 void TestGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { | |
| 427 Bailout("TestGraphVisitor::VisitConditionalExprNode"); | |
| 428 } | |
| 429 | 318 |
| 430 | 319 |
| 431 // <Statement> ::= If { condition: <Expression> | 320 // <Statement> ::= If { condition: <Expression> |
| 432 // true_branch: <Sequence> | 321 // true_branch: <Sequence> |
| 433 // false_branch: <Sequence> } | 322 // false_branch: <Sequence> } |
| 434 void EffectGraphVisitor::VisitIfNode(IfNode* node) { | 323 void EffectGraphVisitor::VisitIfNode(IfNode* node) { |
| 435 TestGraphVisitor for_test(owner(), temp_index()); | 324 TestGraphVisitor for_test(owner(), temp_index()); |
| 436 node->condition()->Visit(&for_test); | 325 node->condition()->Visit(&for_test); |
| 437 | 326 |
| 438 EffectGraphVisitor for_true(owner(), temp_index()); | 327 EffectGraphVisitor for_true(owner(), temp_index()); |
| 439 EffectGraphVisitor for_false(owner(), temp_index()); | 328 EffectGraphVisitor for_false(owner(), temp_index()); |
| 440 | 329 |
| 441 if (for_test.can_be_true()) { | 330 if (for_test.can_be_true()) { |
| 442 node->true_branch()->Visit(&for_true); | 331 node->true_branch()->Visit(&for_true); |
| 443 // The for_false graph fragment will be empty (default graph fragment) | 332 // The for_false graph fragment will be empty (default graph fragment) |
| 444 // if we do not call Visit. | 333 // if we do not call Visit. |
| 445 if (node->false_branch() != NULL) node->false_branch()->Visit(&for_false); | 334 if (node->false_branch() != NULL) node->false_branch()->Visit(&for_false); |
| 446 } | 335 } |
| 447 Join(for_test, for_true, for_false); | 336 Join(for_test, for_true, for_false); |
| 448 } | 337 } |
| 449 | 338 |
| 450 void ValueGraphVisitor::VisitIfNode(IfNode* node) { UNREACHABLE(); } | |
| 451 void TestGraphVisitor::VisitIfNode(IfNode* node) { UNREACHABLE(); } | |
| 452 | |
| 453 | 339 |
| 454 void EffectGraphVisitor::VisitSwitchNode(SwitchNode* node) { | 340 void EffectGraphVisitor::VisitSwitchNode(SwitchNode* node) { |
| 455 Bailout("EffectGraphVisitor::VisitSwitchNode"); | 341 Bailout("EffectGraphVisitor::VisitSwitchNode"); |
| 456 } | 342 } |
| 457 void ValueGraphVisitor::VisitSwitchNode(SwitchNode* node) { | |
| 458 Bailout("ValueGraphVisitor::VisitSwitchNode"); | |
| 459 } | |
| 460 void TestGraphVisitor::VisitSwitchNode(SwitchNode* node) { | |
| 461 Bailout("TestGraphVisitor::VisitSwitchNode"); | |
| 462 } | |
| 463 | 343 |
| 464 | 344 |
| 465 void EffectGraphVisitor::VisitCaseNode(CaseNode* node) { | 345 void EffectGraphVisitor::VisitCaseNode(CaseNode* node) { |
| 466 Bailout("EffectGraphVisitor::VisitCaseNode"); | 346 Bailout("EffectGraphVisitor::VisitCaseNode"); |
| 467 } | 347 } |
| 468 void ValueGraphVisitor::VisitCaseNode(CaseNode* node) { | |
| 469 Bailout("ValueGraphVisitor::VisitCaseNode"); | |
| 470 } | |
| 471 void TestGraphVisitor::VisitCaseNode(CaseNode* node) { | |
| 472 Bailout("TestGraphVisitor::VisitCaseNode"); | |
| 473 } | |
| 474 | 348 |
| 475 | 349 |
| 476 // <Statement> ::= While { label: SourceLabel | 350 // <Statement> ::= While { label: SourceLabel |
| 477 // condition: <Expression> | 351 // condition: <Expression> |
| 478 // body: <Sequence> } | 352 // body: <Sequence> } |
| 479 void EffectGraphVisitor::VisitWhileNode(WhileNode* node) { | 353 void EffectGraphVisitor::VisitWhileNode(WhileNode* node) { |
| 480 TestGraphVisitor for_test(owner(), temp_index()); | 354 TestGraphVisitor for_test(owner(), temp_index()); |
| 481 node->condition()->Visit(&for_test); | 355 node->condition()->Visit(&for_test); |
| 482 | 356 |
| 483 EffectGraphVisitor for_body(owner(), temp_index()); | 357 EffectGraphVisitor for_body(owner(), temp_index()); |
| 484 if (for_test.can_be_true()) node->body()->Visit(&for_body); | 358 if (for_test.can_be_true()) node->body()->Visit(&for_body); |
| 485 TieLoop(for_test, for_body); | 359 TieLoop(for_test, for_body); |
| 486 } | 360 } |
| 487 | 361 |
| 488 void ValueGraphVisitor::VisitWhileNode(WhileNode* node) { UNREACHABLE(); } | |
| 489 void TestGraphVisitor::VisitWhileNode(WhileNode* node) { UNREACHABLE(); } | |
| 490 | |
| 491 | 362 |
| 492 void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { | 363 void EffectGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { |
| 493 Bailout("EffectGraphVisitor::VisitDoWhileNode"); | 364 Bailout("EffectGraphVisitor::VisitDoWhileNode"); |
| 494 } | 365 } |
| 495 void ValueGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { | |
| 496 Bailout("ValueGraphVisitor::VisitDoWhileNode"); | |
| 497 } | |
| 498 void TestGraphVisitor::VisitDoWhileNode(DoWhileNode* node) { | |
| 499 Bailout("TestGraphVisitor::VisitDoWhileNode"); | |
| 500 } | |
| 501 | 366 |
| 502 | 367 |
| 503 void EffectGraphVisitor::VisitForNode(ForNode* node) { | 368 void EffectGraphVisitor::VisitForNode(ForNode* node) { |
| 504 Bailout("EffectGraphVisitor::VisitForNode"); | 369 Bailout("EffectGraphVisitor::VisitForNode"); |
| 505 } | 370 } |
| 506 void ValueGraphVisitor::VisitForNode(ForNode* node) { | |
| 507 Bailout("ValueGraphVisitor::VisitForNode"); | |
| 508 } | |
| 509 void TestGraphVisitor::VisitForNode(ForNode* node) { | |
| 510 Bailout("TestGraphVisitor::VisitForNode"); | |
| 511 } | |
| 512 | 371 |
| 513 | 372 |
| 514 void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { | 373 void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { |
| 515 Bailout("EffectGraphVisitor::VisitJumpNode"); | 374 Bailout("EffectGraphVisitor::VisitJumpNode"); |
| 516 } | 375 } |
| 517 void ValueGraphVisitor::VisitJumpNode(JumpNode* node) { | |
| 518 Bailout("ValueGraphVisitor::VisitJumpNode"); | |
| 519 } | |
| 520 void TestGraphVisitor::VisitJumpNode(JumpNode* node) { | |
| 521 Bailout("TestGraphVisitor::VisitJumpNode"); | |
| 522 } | |
| 523 | 376 |
| 524 | 377 |
| 525 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | 378 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { |
| 526 UNREACHABLE(); | 379 UNREACHABLE(); |
| 527 } | 380 } |
| 528 void ValueGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | |
| 529 UNREACHABLE(); | |
| 530 } | |
| 531 void TestGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | |
| 532 UNREACHABLE(); | |
| 533 } | |
| 534 | 381 |
| 535 | 382 |
| 536 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { | 383 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { |
| 537 Bailout("EffectGraphVisitor::VisitArrayNode"); | 384 Bailout("EffectGraphVisitor::VisitArrayNode"); |
| 538 } | 385 } |
| 539 void ValueGraphVisitor::VisitArrayNode(ArrayNode* node) { | |
| 540 Bailout("ValueGraphVisitor::VisitArrayNode"); | |
| 541 } | |
| 542 void TestGraphVisitor::VisitArrayNode(ArrayNode* node) { | |
| 543 Bailout("TestGraphVisitor::VisitArrayNode"); | |
| 544 } | |
| 545 | 386 |
| 546 | 387 |
| 547 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 388 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
| 548 Bailout("EffectGraphVisitor::VisitClosureNode"); | 389 Bailout("EffectGraphVisitor::VisitClosureNode"); |
| 549 } | 390 } |
| 550 void ValueGraphVisitor::VisitClosureNode(ClosureNode* node) { | |
| 551 Bailout("ValueGraphVisitor::VisitClosureNode"); | |
| 552 } | |
| 553 void TestGraphVisitor::VisitClosureNode(ClosureNode* node) { | |
| 554 Bailout("TestGraphVisitor::VisitClosureNode"); | |
| 555 } | |
| 556 | |
| 557 | |
| 558 InstanceCallComp* EffectGraphVisitor::TranslateInstanceCall( | |
| 559 const InstanceCallNode& node) { | |
| 560 ArgumentListNode* arguments = node.arguments(); | |
| 561 int length = arguments->length(); | |
| 562 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length + 1); | |
| 563 ValueGraphVisitor for_receiver(owner(), temp_index()); | |
| 564 node.receiver()->Visit(&for_receiver); | |
| 565 Append(for_receiver); | |
| 566 CHECK_ALIVE(return NULL); | |
| 567 values->Add(for_receiver.value()); | |
| 568 int index = temp_index(); | |
| 569 for (intptr_t i = 0; i < length; ++i) { | |
| 570 ValueGraphVisitor for_value(owner(), index); | |
| 571 arguments->NodeAt(i)->Visit(&for_value); | |
| 572 Append(for_value); | |
| 573 CHECK_ALIVE(return NULL); | |
| 574 values->Add(for_value.value()); | |
| 575 index = for_value.temp_index(); | |
| 576 } | |
| 577 return new InstanceCallComp(node.function_name().ToCString(), values); | |
| 578 } | |
| 579 | 391 |
| 580 | 392 |
| 581 void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 393 void EffectGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { |
| 582 InstanceCallComp* call = TranslateInstanceCall(*node); | 394 ArgumentListNode* arguments = node->arguments(); |
| 395 int length = arguments->length(); | |
| 396 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length + 1); | |
| 397 | |
| 398 ValueGraphVisitor for_receiver(owner(), temp_index()); | |
| 399 node->receiver()->Visit(&for_receiver); | |
| 400 Append(for_receiver); | |
| 583 CHECK_ALIVE(return); | 401 CHECK_ALIVE(return); |
| 584 DoComputation(call); | 402 Value* receiver_value = for_receiver.value(); |
| 585 } | 403 temp_index_ = for_receiver.temp_index(); |
| 586 void ValueGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 404 if (receiver_value->IsConstant()) { |
| 587 InstanceCallComp* call = TranslateInstanceCall(*node); | 405 AddInstruction(new BindInstr(temp_index(), receiver_value)); |
| 406 receiver_value = new TempVal(AllocateTempIndex()); | |
| 407 } | |
| 408 values->Add(receiver_value); | |
| 409 | |
| 410 TranslateArgumentList(*arguments, values); | |
| 588 CHECK_ALIVE(return); | 411 CHECK_ALIVE(return); |
| 589 ReturnValueOf(call); | 412 InstanceCallComp* call = |
| 590 } | 413 new InstanceCallComp(node->function_name().ToCString(), values); |
| 591 void TestGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 414 ReturnComputation(call); |
| 592 InstanceCallComp* call = TranslateInstanceCall(*node); | |
| 593 CHECK_ALIVE(return); | |
| 594 BranchOnValueOf(call); | |
| 595 } | 415 } |
| 596 | 416 |
| 597 | 417 |
| 598 void EffectGraphVisitor::TranslateArgumentList( | 418 void EffectGraphVisitor::TranslateArgumentList( |
| 599 const ArgumentListNode& node, ZoneGrowableArray<Value*>* values) { | 419 const ArgumentListNode& node, ZoneGrowableArray<Value*>* values) { |
| 600 int index = temp_index(); | 420 int index = temp_index(); |
| 601 for (intptr_t i = 0; i < node.length(); ++i) { | 421 for (intptr_t i = 0; i < node.length(); ++i) { |
| 602 ValueGraphVisitor for_value(owner(), index); | 422 ValueGraphVisitor for_value(owner(), index); |
| 603 node.NodeAt(i)->Visit(&for_value); | 423 node.NodeAt(i)->Visit(&for_value); |
| 604 Append(for_value); | 424 Append(for_value); |
| 605 CHECK_ALIVE(return); | 425 CHECK_ALIVE(return); |
| 606 Value* argument_value = for_value.value(); | 426 Value* argument_value = for_value.value(); |
| 607 index = for_value.temp_index(); | 427 index = for_value.temp_index(); |
| 608 if (argument_value->IsConstant()) { | 428 if (argument_value->IsConstant()) { |
| 609 AddInstruction(new BindInstr(index, argument_value)); | 429 AddInstruction(new BindInstr(index, argument_value)); |
| 610 argument_value = new TempVal(index++); | 430 argument_value = new TempVal(index++); |
| 611 } | 431 } |
| 612 values->Add(argument_value); | 432 values->Add(argument_value); |
| 613 } | 433 } |
| 614 } | 434 } |
| 615 | 435 |
| 616 // <Expression> ::= StaticCall { function: Function | 436 // <Expression> ::= StaticCall { function: Function |
| 617 // arguments: <ArgumentList> } | 437 // arguments: <ArgumentList> } |
| 618 StaticCallComp* EffectGraphVisitor::TranslateStaticCall( | 438 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| 619 const StaticCallNode& node) { | 439 int length = node->arguments()->length(); |
| 620 int length = node.arguments()->length(); | |
| 621 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length); | 440 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length); |
| 622 TranslateArgumentList(*node.arguments(), values); | 441 TranslateArgumentList(*node->arguments(), values); |
| 623 CHECK_ALIVE(return NULL); | |
| 624 return new StaticCallComp(node.function(), values); | |
| 625 } | |
| 626 | |
| 627 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | |
| 628 StaticCallComp* call = TranslateStaticCall(*node); | |
| 629 CHECK_ALIVE(return); | 442 CHECK_ALIVE(return); |
| 630 DoComputation(call); | 443 StaticCallComp* call = new StaticCallComp(node->function(), values); |
| 631 } | 444 ReturnComputation(call); |
| 632 | |
| 633 void ValueGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | |
| 634 StaticCallComp* call = TranslateStaticCall(*node); | |
| 635 CHECK_ALIVE(return); | |
| 636 ReturnValueOf(call); | |
| 637 } | |
| 638 | |
| 639 void TestGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | |
| 640 StaticCallComp* call = TranslateStaticCall(*node); | |
| 641 CHECK_ALIVE(return); | |
| 642 BranchOnValueOf(call); | |
| 643 } | 445 } |
| 644 | 446 |
| 645 | 447 |
| 646 void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { | 448 void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { |
| 647 Bailout("EffectGraphVisitor::VisitClosureCallNode"); | 449 Bailout("EffectGraphVisitor::VisitClosureCallNode"); |
| 648 } | 450 } |
| 649 void ValueGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { | |
| 650 Bailout("ValueGraphVisitor::VisitClosureCallNode"); | |
| 651 } | |
| 652 void TestGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) { | |
| 653 Bailout("TestGraphVisitor::VisitClosureCallNode"); | |
| 654 } | |
| 655 | 451 |
| 656 | 452 |
| 657 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { | 453 void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { |
| 658 Bailout("EffectGraphVisitor::VisitCloneContextNode"); | 454 Bailout("EffectGraphVisitor::VisitCloneContextNode"); |
| 659 } | 455 } |
| 660 void ValueGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { | |
| 661 Bailout("ValueGraphVisitor::VisitCloneContextNode"); | |
| 662 } | |
| 663 void TestGraphVisitor::VisitCloneContextNode(CloneContextNode* node) { | |
| 664 Bailout("TestGraphVisitor::VisitCloneContextNode"); | |
| 665 } | |
| 666 | 456 |
| 667 | 457 |
| 668 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 458 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 669 Bailout("EffectGraphVisitor::VisitConstructorCallNode"); | 459 Bailout("EffectGraphVisitor::VisitConstructorCallNode"); |
| 670 } | 460 } |
| 671 void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | |
| 672 Bailout("ValueGraphVisitor::VisitConstructorCallNode"); | |
| 673 } | |
| 674 void TestGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | |
| 675 Bailout("TestGraphVisitor::VisitConstructorCallNode"); | |
| 676 } | |
| 677 | 461 |
| 678 | 462 |
| 679 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { | 463 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { |
| 680 Bailout("EffectGraphVisitor::VisitInstanceGetterNode"); | 464 Bailout("EffectGraphVisitor::VisitInstanceGetterNode"); |
| 681 } | 465 } |
| 682 void ValueGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { | |
| 683 Bailout("ValueGraphVisitor::VisitInstanceGetterNode"); | |
| 684 } | |
| 685 void TestGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { | |
| 686 Bailout("TestGraphVisitor::VisitInstanceGetterNode"); | |
| 687 } | |
| 688 | 466 |
| 689 | 467 |
| 690 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | 468 void EffectGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { |
| 691 Bailout("EffectGraphVisitor::VisitInstanceSetterNode"); | 469 Bailout("EffectGraphVisitor::VisitInstanceSetterNode"); |
| 692 } | 470 } |
| 693 void ValueGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | |
| 694 Bailout("ValueGraphVisitor::VisitInstanceSetterNode"); | |
| 695 } | |
| 696 void TestGraphVisitor::VisitInstanceSetterNode(InstanceSetterNode* node) { | |
| 697 Bailout("TestGraphVisitor::VisitInstanceSetterNode"); | |
| 698 } | |
| 699 | 471 |
| 700 | 472 |
| 701 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { | 473 void EffectGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { |
| 702 Bailout("EffectGraphVisitor::VisitStaticGetterNode"); | 474 Bailout("EffectGraphVisitor::VisitStaticGetterNode"); |
| 703 } | 475 } |
| 704 void ValueGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { | |
| 705 Bailout("ValueGraphVisitor::VisitStaticGetterNode"); | |
| 706 } | |
| 707 void TestGraphVisitor::VisitStaticGetterNode(StaticGetterNode* node) { | |
| 708 Bailout("TestGraphVisitor::VisitStaticGetterNode"); | |
| 709 } | |
| 710 | 476 |
| 711 | 477 |
| 712 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { | 478 void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { |
| 713 Bailout("EffectGraphVisitor::VisitStaticSetterNode"); | 479 Bailout("EffectGraphVisitor::VisitStaticSetterNode"); |
| 714 } | 480 } |
| 715 void ValueGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { | |
| 716 Bailout("ValueGraphVisitor::VisitStaticSetterNode"); | |
| 717 } | |
| 718 void TestGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) { | |
| 719 Bailout("TestGraphVisitor::VisitStaticSetterNode"); | |
| 720 } | |
| 721 | 481 |
| 722 | 482 |
| 723 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { | 483 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { |
| 724 Bailout("EffectGraphVisitor::VisitNativeBodyNode"); | 484 NativeCallComp* native_call = new NativeCallComp(node); |
| 725 } | 485 ReturnComputation(native_call); |
| 726 void ValueGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { | |
| 727 Bailout("ValueGraphVisitor::VisitNativeBodyNode"); | |
| 728 } | |
| 729 void TestGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { | |
| 730 Bailout("TestGraphVisitor::VisitNativeBodyNode"); | |
| 731 } | 486 } |
| 732 | 487 |
| 733 | 488 |
| 734 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { | 489 void EffectGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { |
| 735 Bailout("EffectGraphVisitor::VisitPrimaryNode"); | 490 Bailout("EffectGraphVisitor::VisitPrimaryNode"); |
| 736 } | 491 } |
| 737 void ValueGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { | |
| 738 Bailout("ValueGraphVisitor::VisitPrimaryNode"); | |
| 739 } | |
| 740 void TestGraphVisitor::VisitPrimaryNode(PrimaryNode* node) { | |
| 741 Bailout("TestGraphVisitor::VisitPrimaryNode"); | |
| 742 } | |
| 743 | 492 |
| 744 | 493 |
| 745 // <Expression> ::= LoadLocal { local: LocalVariable } | 494 // <Expression> ::= LoadLocal { local: LocalVariable } |
| 746 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 495 void EffectGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 747 return; | 496 return; |
| 748 } | 497 } |
| 749 | 498 |
| 750 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 499 void ValueGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 751 LoadLocalComp* load = new LoadLocalComp(node->local()); | 500 LoadLocalComp* load = new LoadLocalComp(node->local()); |
| 752 ReturnValueOf(load); | 501 ReturnComputation(load); |
| 753 } | 502 } |
| 754 | 503 |
| 755 void TestGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { | 504 void TestGraphVisitor::VisitLoadLocalNode(LoadLocalNode* node) { |
| 756 LoadLocalComp* load = new LoadLocalComp(node->local()); | 505 LoadLocalComp* load = new LoadLocalComp(node->local()); |
| 757 BranchOnValueOf(load); | 506 ReturnComputation(load); |
| 758 } | 507 } |
| 759 | 508 |
| 760 | 509 |
| 761 // <Expression> ::= StoreLocal { local: LocalVariable | 510 // <Expression> ::= StoreLocal { local: LocalVariable |
| 762 // value: <Expression> } | 511 // value: <Expression> } |
| 763 StoreLocalComp* EffectGraphVisitor::TranslateStoreLocal( | 512 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { |
| 764 const StoreLocalNode& node) { | |
| 765 ValueGraphVisitor for_value(owner(), temp_index()); | 513 ValueGraphVisitor for_value(owner(), temp_index()); |
| 766 node.value()->Visit(&for_value); | 514 node->value()->Visit(&for_value); |
| 767 Append(for_value); | 515 Append(for_value); |
| 768 CHECK_ALIVE(return NULL); | |
| 769 return new StoreLocalComp(node.local(), for_value.value()); | |
| 770 } | |
| 771 | |
| 772 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { | |
| 773 StoreLocalComp* store = TranslateStoreLocal(*node); | |
| 774 CHECK_ALIVE(return); | 516 CHECK_ALIVE(return); |
| 775 DoComputation(store); | 517 StoreLocalComp* store = new StoreLocalComp(node->local(), for_value.value()); |
| 776 } | 518 ReturnComputation(store); |
| 777 | |
| 778 void ValueGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { | |
| 779 StoreLocalComp* store = TranslateStoreLocal(*node); | |
| 780 CHECK_ALIVE(return); | |
| 781 ReturnValueOf(store); | |
| 782 } | |
| 783 | |
| 784 void TestGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { | |
| 785 StoreLocalComp* store = TranslateStoreLocal(*node); | |
| 786 CHECK_ALIVE(return); | |
| 787 BranchOnValueOf(store); | |
| 788 } | 519 } |
| 789 | 520 |
| 790 | 521 |
| 791 void EffectGraphVisitor::VisitLoadInstanceFieldNode( | 522 void EffectGraphVisitor::VisitLoadInstanceFieldNode( |
| 792 LoadInstanceFieldNode* node) { | 523 LoadInstanceFieldNode* node) { |
| 793 Bailout("EffectGraphVisitor::VisitLoadInstanceFieldNode"); | 524 Bailout("EffectGraphVisitor::VisitLoadInstanceFieldNode"); |
| 794 } | 525 } |
| 795 void ValueGraphVisitor::VisitLoadInstanceFieldNode( | |
| 796 LoadInstanceFieldNode* node) { | |
| 797 Bailout("ValueGraphVisitor::VisitLoadInstanceFieldNode"); | |
| 798 } | |
| 799 void TestGraphVisitor::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | |
| 800 Bailout("TestGraphVisitor::VisitLoadInstanceFieldNode"); | |
| 801 } | |
| 802 | 526 |
| 803 | 527 |
| 804 void EffectGraphVisitor::VisitStoreInstanceFieldNode( | 528 void EffectGraphVisitor::VisitStoreInstanceFieldNode( |
| 805 StoreInstanceFieldNode* node) { | 529 StoreInstanceFieldNode* node) { |
| 806 Bailout("EffectGraphVisitor::VisitStoreInstanceFieldNode"); | 530 Bailout("EffectGraphVisitor::VisitStoreInstanceFieldNode"); |
| 807 } | 531 } |
| 808 void ValueGraphVisitor::VisitStoreInstanceFieldNode( | |
| 809 StoreInstanceFieldNode* node) { | |
| 810 Bailout("ValueGraphVisitor::VisitStoreInstanceFieldNode"); | |
| 811 } | |
| 812 void TestGraphVisitor::VisitStoreInstanceFieldNode( | |
| 813 StoreInstanceFieldNode* node) { | |
| 814 Bailout("TestGraphVisitor::VisitStoreInstanceFieldNode"); | |
| 815 } | |
| 816 | 532 |
| 817 | 533 |
| 818 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | 534 void EffectGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { |
| 819 Bailout("EffectGraphVisitor::VisitLoadStaticFieldNode"); | 535 Bailout("EffectGraphVisitor::VisitLoadStaticFieldNode"); |
| 820 } | 536 } |
| 821 void ValueGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | |
| 822 Bailout("ValueGraphVisitor::VisitLoadStaticFieldNode"); | |
| 823 } | |
| 824 void TestGraphVisitor::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) { | |
| 825 Bailout("TestGraphVisitor::VisitLoadStaticFieldNode"); | |
| 826 } | |
| 827 | 537 |
| 828 | 538 |
| 829 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | 539 void EffectGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { |
| 830 Bailout("EffectGraphVisitor::VisitStoreStaticFieldNode"); | 540 Bailout("EffectGraphVisitor::VisitStoreStaticFieldNode"); |
| 831 } | 541 } |
| 832 void ValueGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | |
| 833 Bailout("ValueGraphVisitor::VisitStoreStaticFieldNode"); | |
| 834 } | |
| 835 void TestGraphVisitor::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) { | |
| 836 Bailout("TestGraphVisitor::VisitStoreStaticFieldNode"); | |
| 837 } | |
| 838 | 542 |
| 839 | 543 |
| 840 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { | 544 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { |
| 841 Bailout("EffectGraphVisitor::VisitLoadIndexedNode"); | 545 Bailout("EffectGraphVisitor::VisitLoadIndexedNode"); |
| 842 } | 546 } |
| 843 void ValueGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { | |
| 844 Bailout("ValueGraphVisitor::VisitLoadIndexedNode"); | |
| 845 } | |
| 846 void TestGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { | |
| 847 Bailout("TestGraphVisitor::VisitLoadIndexedNode"); | |
| 848 } | |
| 849 | 547 |
| 850 | 548 |
| 851 void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { | 549 void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { |
| 852 Bailout("EffectGraphVisitor::VisitStoreIndexedNode"); | 550 Bailout("EffectGraphVisitor::VisitStoreIndexedNode"); |
| 853 } | 551 } |
| 854 void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { | |
| 855 Bailout("ValueGraphVisitor::VisitStoreIndexedNode"); | |
| 856 } | |
| 857 void TestGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { | |
| 858 Bailout("TestGraphVisitor::VisitStoreIndexedNode"); | |
| 859 } | |
| 860 | 552 |
| 861 | 553 |
| 862 // <Statement> ::= Sequence { scope: LocalScope | 554 // <Statement> ::= Sequence { scope: LocalScope |
| 863 // nodes: <Statement>* | 555 // nodes: <Statement>* |
| 864 // label: SourceLabel } | 556 // label: SourceLabel } |
| 865 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { | 557 void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) { |
| 866 if ((node->scope() != NULL) && | 558 if ((node->scope() != NULL) && |
| 867 (node->scope()->num_context_variables() != 0)) { | 559 (node->scope()->num_context_variables() != 0)) { |
| 868 Bailout("Sequence needs a context. Gotta have a context."); | 560 Bailout("Sequence needs a context. Gotta have a context."); |
| 869 } | 561 } |
| 870 for (intptr_t i = 0; i < node->length(); ++i) { | 562 for (intptr_t i = 0; i < node->length(); ++i) { |
| 871 EffectGraphVisitor for_effect(owner(), temp_index()); | 563 EffectGraphVisitor for_effect(owner(), temp_index()); |
| 872 node->NodeAt(i)->Visit(&for_effect); | 564 node->NodeAt(i)->Visit(&for_effect); |
| 873 Append(for_effect); | 565 Append(for_effect); |
| 874 CHECK_ALIVE(return); | 566 CHECK_ALIVE(return); |
| 875 } | 567 } |
| 876 } | 568 } |
| 877 | 569 |
| 878 void ValueGraphVisitor::VisitSequenceNode(SequenceNode* node) { UNREACHABLE(); } | |
| 879 void TestGraphVisitor::VisitSequenceNode(SequenceNode* node) { UNREACHABLE(); } | |
| 880 | |
| 881 | 570 |
| 882 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | 571 void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { |
| 883 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); | 572 Bailout("EffectGraphVisitor::VisitCatchClauseNode"); |
| 884 } | 573 } |
| 885 void ValueGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | |
| 886 Bailout("ValueGraphVisitor::VisitCatchClauseNode"); | |
| 887 } | |
| 888 void TestGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) { | |
| 889 Bailout("TestGraphVisitor::VisitCatchClauseNode"); | |
| 890 } | |
| 891 | 574 |
| 892 | 575 |
| 893 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | 576 void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { |
| 894 Bailout("EffectGraphVisitor::VisitTryCatchNode"); | 577 Bailout("EffectGraphVisitor::VisitTryCatchNode"); |
| 895 } | 578 } |
| 896 void ValueGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | |
| 897 Bailout("ValueGraphVisitor::VisitTryCatchNode"); | |
| 898 } | |
| 899 void TestGraphVisitor::VisitTryCatchNode(TryCatchNode* node) { | |
| 900 Bailout("TestGraphVisitor::VisitTryCatchNode"); | |
| 901 } | |
| 902 | 579 |
| 903 | 580 |
| 904 void EffectGraphVisitor::VisitThrowNode(ThrowNode* node) { | 581 void EffectGraphVisitor::VisitThrowNode(ThrowNode* node) { |
| 905 Bailout("EffectGraphVisitor::VisitThrowNode"); | 582 Bailout("EffectGraphVisitor::VisitThrowNode"); |
| 906 } | 583 } |
| 907 void ValueGraphVisitor::VisitThrowNode(ThrowNode* node) { | |
| 908 Bailout("ValueGraphVisitor::VisitThrowNode"); | |
| 909 } | |
| 910 void TestGraphVisitor::VisitThrowNode(ThrowNode* node) { | |
| 911 Bailout("TestGraphVisitor::VisitThrowNode"); | |
| 912 } | |
| 913 | 584 |
| 914 | 585 |
| 915 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | 586 void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { |
| 916 Bailout("EffectGraphVisitor::VisitInlinedFinallyNode"); | 587 Bailout("EffectGraphVisitor::VisitInlinedFinallyNode"); |
| 917 } | 588 } |
| 918 void ValueGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | |
| 919 Bailout("ValueGraphVisitor::VisitInlinedFinallyNode"); | |
| 920 } | |
| 921 void TestGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | |
| 922 Bailout("TestGraphVisitor::VisitInlinedFinallyNode"); | |
| 923 } | |
| 924 | 589 |
| 925 | 590 |
| 926 // Graph printing. | 591 // Graph printing. |
| 927 class FlowGraphPrinter : public FlowGraphVisitor { | 592 class FlowGraphPrinter : public FlowGraphVisitor { |
| 928 public: | 593 public: |
| 929 explicit FlowGraphPrinter(const Function& function) : function_(function) { } | 594 explicit FlowGraphPrinter(const Function& function) : function_(function) { } |
| 930 | 595 |
| 931 virtual ~FlowGraphPrinter() {} | 596 virtual ~FlowGraphPrinter() {} |
| 932 | 597 |
| 933 // Print the instructions in a block terminated by newlines. Add "goto N" | 598 // Print the instructions in a block terminated by newlines. Add "goto N" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 } | 696 } |
| 1032 | 697 |
| 1033 | 698 |
| 1034 void FlowGraphPrinter::VisitStoreLocal(StoreLocalComp* comp) { | 699 void FlowGraphPrinter::VisitStoreLocal(StoreLocalComp* comp) { |
| 1035 OS::Print("StoreLocal(%s, ", comp->local().name().ToCString()); | 700 OS::Print("StoreLocal(%s, ", comp->local().name().ToCString()); |
| 1036 comp->value()->Accept(this); | 701 comp->value()->Accept(this); |
| 1037 OS::Print(")"); | 702 OS::Print(")"); |
| 1038 } | 703 } |
| 1039 | 704 |
| 1040 | 705 |
| 706 void FlowGraphPrinter::VisitNativeCall(NativeCallComp* comp) { | |
| 707 OS::Print("NativeCall '%s'", comp->native_name().ToCString()); | |
|
Kevin Millikin (Google)
2012/03/01 09:26:22
For uniformity this should probably print as
Nati
srdjan
2012/03/01 17:25:42
Done.
| |
| 708 } | |
| 709 | |
| 710 | |
| 1041 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { | 711 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { |
| 1042 OS::Print("%2d: [join]", instr->block_number()); | 712 OS::Print("%2d: [join]", instr->block_number()); |
| 1043 } | 713 } |
| 1044 | 714 |
| 1045 | 715 |
| 1046 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { | 716 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { |
| 1047 OS::Print("%2d: [target]", instr->block_number()); | 717 OS::Print("%2d: [target]", instr->block_number()); |
| 1048 } | 718 } |
| 1049 | 719 |
| 1050 | 720 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1101 char* chars = reinterpret_cast<char*>( | 771 char* chars = reinterpret_cast<char*>( |
| 1102 Isolate::Current()->current_zone()->Allocate(len)); | 772 Isolate::Current()->current_zone()->Allocate(len)); |
| 1103 OS::SNPrint(chars, len, kFormat, function_name, reason); | 773 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1104 const Error& error = Error::Handle( | 774 const Error& error = Error::Handle( |
| 1105 LanguageError::New(String::Handle(String::New(chars)))); | 775 LanguageError::New(String::Handle(String::New(chars)))); |
| 1106 Isolate::Current()->long_jump_base()->Jump(1, error); | 776 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1107 } | 777 } |
| 1108 | 778 |
| 1109 | 779 |
| 1110 } // namespace dart | 780 } // namespace dart |
| OLD | NEW |