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

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

Issue 15741002: Use a uniform way to emit code for all instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 1408
1409 1409
1410 // Shared code generation methods (EmitNativeCode and 1410 // Shared code generation methods (EmitNativeCode and
1411 // MakeLocationSummary). Only assembly code that can be shared across all 1411 // MakeLocationSummary). Only assembly code that can be shared across all
1412 // architectures can be used. Machine specific register allocation and code 1412 // architectures can be used. Machine specific register allocation and code
1413 // generation is located in intermediate_language_<arch>.cc 1413 // generation is located in intermediate_language_<arch>.cc
1414 1414
1415 #define __ compiler->assembler()-> 1415 #define __ compiler->assembler()->
1416 1416
1417 LocationSummary* GraphEntryInstr::MakeLocationSummary() const { 1417 LocationSummary* GraphEntryInstr::MakeLocationSummary() const {
1418 UNREACHABLE(); 1418 return new LocationSummary(0, 0, LocationSummary::kNoCall);
1419 return NULL;
1420 } 1419 }
1421 1420
1422 1421
1423 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1422 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1424 // Nothing to do. 1423 // Nothing to do.
1425 } 1424 }
1426 1425
1427 1426
1428 LocationSummary* JoinEntryInstr::MakeLocationSummary() const { 1427 LocationSummary* JoinEntryInstr::MakeLocationSummary() const {
1429 UNREACHABLE(); 1428 return new LocationSummary(0, 0, LocationSummary::kNoCall);
Florian Schneider 2013/05/22 15:56:15 Is this ever called? If no, just return NULL. Othe
Kevin Millikin (Google) 2013/05/23 09:09:49 Yes, it's called by the nonoptimizing compiler. I
1430 return NULL;
1431 } 1429 }
1432 1430
1433 1431
1434 void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1432 void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1435 if (!compiler->is_optimizing()) {
1436 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
1437 deopt_id_,
1438 Scanner::kDummyTokenIndex);
1439 }
1440 __ Bind(compiler->GetJumpLabel(this)); 1433 __ Bind(compiler->GetJumpLabel(this));
1441 if (HasParallelMove()) { 1434 if (HasParallelMove()) {
1442 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 1435 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
1443 } 1436 }
1444 } 1437 }
1445 1438
1446 1439
1447 LocationSummary* TargetEntryInstr::MakeLocationSummary() const { 1440 LocationSummary* TargetEntryInstr::MakeLocationSummary() const {
1448 UNREACHABLE(); 1441 return new LocationSummary(0, 0, LocationSummary::kNoCall);
1449 return NULL;
1450 } 1442 }
1451 1443
1452 1444
1453 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1445 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1454 if (!compiler->is_optimizing()) {
1455 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
1456 deopt_id_,
1457 Scanner::kDummyTokenIndex);
1458 }
1459 __ Bind(compiler->GetJumpLabel(this)); 1446 __ Bind(compiler->GetJumpLabel(this));
1460 if (HasParallelMove()) { 1447 if (HasParallelMove()) {
1461 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 1448 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
1462 } 1449 }
1463 } 1450 }
1464 1451
1465 1452
1466 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { 1453 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
1467 UNREACHABLE(); 1454 return new LocationSummary(0, 0, LocationSummary::kNoCall);
1468 return NULL;
1469 } 1455 }
1470 1456
1471 1457
1472 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1458 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1473 __ Bind(compiler->GetJumpLabel(this)); 1459 __ Bind(compiler->GetJumpLabel(this));
1474 compiler->AddExceptionHandler(catch_try_index(), 1460 compiler->AddExceptionHandler(catch_try_index(),
1475 try_index(), 1461 try_index(),
1476 compiler->assembler()->CodeSize(), 1462 compiler->assembler()->CodeSize(),
1477 catch_handler_types_); 1463 catch_handler_types_);
1478 if (HasParallelMove()) { 1464 if (HasParallelMove()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 UNREACHABLE(); 1499 UNREACHABLE();
1514 } 1500 }
1515 1501
1516 1502
1517 LocationSummary* ParallelMoveInstr::MakeLocationSummary() const { 1503 LocationSummary* ParallelMoveInstr::MakeLocationSummary() const {
1518 return NULL; 1504 return NULL;
1519 } 1505 }
1520 1506
1521 1507
1522 void ParallelMoveInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1508 void ParallelMoveInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1523 UNREACHABLE(); 1509 compiler->parallel_move_resolver()->EmitNativeCode(this);
1524 } 1510 }
1525 1511
1526 1512
1527 LocationSummary* ConstraintInstr::MakeLocationSummary() const { 1513 LocationSummary* ConstraintInstr::MakeLocationSummary() const {
1528 UNREACHABLE(); 1514 UNREACHABLE();
1529 return NULL; 1515 return NULL;
1530 } 1516 }
1531 1517
1532 1518
1533 void ConstraintInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1519 void ConstraintInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 return -1; 2351 return -1;
2366 } 2352 }
2367 } 2353 }
2368 2354
2369 2355
2370 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( 2356 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr(
2371 ZoneGrowableArray<Value*>* inputs, 2357 ZoneGrowableArray<Value*>* inputs,
2372 InstanceCallInstr* instance_call, 2358 InstanceCallInstr* instance_call,
2373 MethodRecognizer::Kind recognized_kind) 2359 MethodRecognizer::Kind recognized_kind)
2374 : inputs_(inputs), 2360 : inputs_(inputs),
2375 locs_(NULL),
2376 recognized_kind_(recognized_kind) { 2361 recognized_kind_(recognized_kind) {
2377 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_)); 2362 ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_));
2378 for (intptr_t i = 0; i < inputs_->length(); ++i) { 2363 for (intptr_t i = 0; i < inputs_->length(); ++i) {
2379 ASSERT((*inputs)[i] != NULL); 2364 ASSERT((*inputs)[i] != NULL);
2380 (*inputs)[i]->set_instruction(this); 2365 (*inputs)[i]->set_instruction(this);
2381 (*inputs)[i]->set_use_index(i); 2366 (*inputs)[i]->set_use_index(i);
2382 } 2367 }
2383 deopt_id_ = instance_call->deopt_id(); 2368 deopt_id_ = instance_call->deopt_id();
2384 } 2369 }
2385 2370
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 default: 2435 default:
2451 UNREACHABLE(); 2436 UNREACHABLE();
2452 } 2437 }
2453 return kPowRuntimeEntry; 2438 return kPowRuntimeEntry;
2454 } 2439 }
2455 2440
2456 2441
2457 #undef __ 2442 #undef __
2458 2443
2459 } // namespace dart 2444 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698