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

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

Issue 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: Incorporate review comments. Created 3 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
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_reader.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 8
9 #if !defined(DART_PRECOMPILED_RUNTIME) 9 #if !defined(DART_PRECOMPILED_RUNTIME)
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // We return a new `ZoneHandle` here on purpose: The intermediate language 56 // We return a new `ZoneHandle` here on purpose: The intermediate language
57 // instructions do not make a copy of the handle, so we do it. 57 // instructions do not make a copy of the handle, so we do it.
58 return dart::Instance::ZoneHandle(Z, result_.raw()); 58 return dart::Instance::ZoneHandle(Z, result_.raw());
59 } 59 }
60 60
61 void StreamingConstantEvaluator::EvaluateStaticGet() { 61 void StreamingConstantEvaluator::EvaluateStaticGet() {
62 builder_->ReadPosition(); 62 builder_->ReadPosition();
63 int canonical_name_index = builder_->ReadUInt(); 63 int canonical_name_index = builder_->ReadUInt();
64 CanonicalName* target = builder_->GetCanonicalName(canonical_name_index); 64 CanonicalName* target = builder_->GetCanonicalName(canonical_name_index);
65 65
66 if (target->IsField()) { 66 if (H.IsField(target)) {
67 const dart::Field& field = 67 const dart::Field& field =
68 dart::Field::Handle(Z, H.LookupFieldByKernelField(target)); 68 dart::Field::Handle(Z, H.LookupFieldByKernelField(target));
69 if (field.StaticValue() == Object::sentinel().raw() || 69 if (field.StaticValue() == Object::sentinel().raw() ||
70 field.StaticValue() == Object::transition_sentinel().raw()) { 70 field.StaticValue() == Object::transition_sentinel().raw()) {
71 field.EvaluateInitializer(); 71 field.EvaluateInitializer();
72 result_ = field.StaticValue(); 72 result_ = field.StaticValue();
73 result_ = H.Canonicalize(result_); 73 result_ = H.Canonicalize(result_);
74 field.SetStaticValue(result_, true); 74 field.SetStaticValue(result_, true);
75 } else { 75 } else {
76 result_ = field.StaticValue(); 76 result_ = field.StaticValue();
77 } 77 }
78 } else if (target->IsProcedure()) { 78 } else if (H.IsProcedure(target)) {
79 const Function& function = 79 const Function& function =
80 Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target)); 80 Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target));
81 81
82 if (target->IsMethod()) { 82 if (H.IsMethod(target)) {
83 Function& closure_function = 83 Function& closure_function =
84 Function::ZoneHandle(Z, function.ImplicitClosureFunction()); 84 Function::ZoneHandle(Z, function.ImplicitClosureFunction());
85 closure_function.set_kernel_function(function.kernel_function()); 85 closure_function.set_kernel_function(function.kernel_function());
86 result_ = closure_function.ImplicitStaticClosure(); 86 result_ = closure_function.ImplicitStaticClosure();
87 result_ = H.Canonicalize(result_); 87 result_ = H.Canonicalize(result_);
88 } else if (target->IsGetter()) { 88 } else if (H.IsGetter(target)) {
89 UNIMPLEMENTED(); 89 UNIMPLEMENTED();
90 } else { 90 } else {
91 UNIMPLEMENTED(); 91 UNIMPLEMENTED();
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 void StreamingConstantEvaluator::EvaluateSymbolLiteral() { 96 void StreamingConstantEvaluator::EvaluateSymbolLiteral() {
97 int str_index = builder_->ReadUInt(); 97 int str_index = builder_->ReadUInt();
98 const dart::String& symbol_value = builder_->DartSymbol(str_index); 98 const dart::String& symbol_value = builder_->DartSymbol(str_index);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return BuildBoolLiteral(false); 300 return BuildBoolLiteral(false);
301 case kNullLiteral: 301 case kNullLiteral:
302 return BuildNullLiteral(); 302 return BuildNullLiteral();
303 default: 303 default:
304 UNREACHABLE(); 304 UNREACHABLE();
305 } 305 }
306 306
307 return Fragment(); 307 return Fragment();
308 } 308 }
309 309
310
310 intptr_t StreamingFlowGraphBuilder::GetStringOffset(intptr_t index) { 311 intptr_t StreamingFlowGraphBuilder::GetStringOffset(intptr_t index) {
311 if (string_offsets_ == NULL) { 312 if (string_offsets_ == NULL) {
312 intptr_t saved_offset = ReaderOffset(); 313 intptr_t saved_offset = ReaderOffset();
313 reader_->set_offset(4); // Skip kMagicProgramFile to the string table. 314 reader_->set_offset(4); // Skip kMagicProgramFile to the string table.
314 string_offset_count_ = ReadListLength() + 1; 315 string_offset_count_ = ReadListLength() + 1;
315 string_offsets_ = new intptr_t[string_offset_count_]; 316 string_offsets_ = new intptr_t[string_offset_count_];
316 317
317 // Build a table of the 0-based string start and end offsets. 318 // Build a table of the 0-based string start and end offsets.
318 string_offsets_[0] = 0; 319 string_offsets_[0] = 0;
319 for (intptr_t i = 1; i < string_offset_count_; ++i) { 320 for (intptr_t i = 1; i < string_offset_count_; ++i) {
320 string_offsets_[i] = ReadUInt(); 321 string_offsets_[i] = ReadUInt();
321 } 322 }
322 // And adjust the offsets now that we know the start offset of the first 323 // Mark the start of the string data to use for decoding strings.
323 // string relative to the start of the binary. 324 reader_->MarkStringDataOffset();
324 intptr_t base = ReaderOffset();
325 for (intptr_t i = 0; i < string_offset_count_; ++i) {
326 string_offsets_[i] += base;
327 }
328
329 SetOffset(saved_offset); 325 SetOffset(saved_offset);
330 } 326 }
331 return string_offsets_[index]; 327 return string_offsets_[index];
332 } 328 }
333 329
330
334 CanonicalName* StreamingFlowGraphBuilder::GetCanonicalName(intptr_t index) { 331 CanonicalName* StreamingFlowGraphBuilder::GetCanonicalName(intptr_t index) {
335 if (index == 0) return NULL; 332 if (index == 0) return NULL;
336 --index; 333 --index;
337 334
338 if (canonical_names_ != NULL && canonical_names_entries_read_ > index) { 335 if (canonical_names_ != NULL && canonical_names_entries_read_ > index) {
339 return canonical_names_[index]; 336 return canonical_names_[index];
340 } 337 }
341 338
342 intptr_t saved_offset = ReaderOffset(); 339 intptr_t saved_offset = ReaderOffset();
343 if (canonical_names_ == NULL) { 340 if (canonical_names_ == NULL) {
344 // Find offset from where to read canonical names table. 341 // Find offset from where to read canonical names table.
345 342
346 // First skip the string table. The last offset is the end offset of the 343 // Skip the magic number.
347 // last string. 344 reader_->set_offset(4);
348 if (string_offsets_ == NULL) {
349 // Ensure that the length and all the offsets are available.
350 GetStringOffset(0);
351 }
352 SetOffset(GetStringOffset(string_offset_count_ - 1));
353 345
354 // There is another string table for the source URIs. Skip it as well. 346 // Skip the string table. The last offset is the end offset of the last
347 // string which gives the length of the string data.
355 intptr_t list_length = ReadListLength(); 348 intptr_t list_length = ReadListLength();
356 intptr_t end_offset = 0; 349 intptr_t end_offset = 0;
357 for (intptr_t i = 0; i < list_length; ++i) { 350 for (intptr_t i = 0; i < list_length; ++i) {
358 end_offset = ReadUInt(); 351 end_offset = ReadUInt();
359 } 352 }
360 SkipBytes(end_offset); 353 SkipBytes(end_offset);
361 354
355 // There is another string table for the source URIs. Skip it as well.
356 list_length = ReadListLength();
357 end_offset = 0;
358 for (intptr_t i = 0; i < list_length; ++i) {
359 end_offset = ReadUInt();
360 }
361 SkipBytes(end_offset);
362
362 // Source code table 363 // Source code table
363 for (intptr_t i = 0; i < list_length; ++i) { 364 for (intptr_t i = 0; i < list_length; ++i) {
364 // Source code 365 // Source code
365 intptr_t bytes = ReadUInt(); 366 intptr_t bytes = ReadUInt();
366 SkipBytes(bytes); 367 SkipBytes(bytes);
367 368
368 // Line starts table 369 // Line starts table
369 intptr_t line_count = ReadUInt(); 370 intptr_t line_count = ReadUInt();
370 for (intptr_t j = 0; j < line_count; ++j) { 371 for (intptr_t j = 0; j < line_count; ++j) {
371 ReadUInt(); 372 ReadUInt();
(...skipping 26 matching lines...) Expand all
398 CanonicalName* canonical_name = parent->AddChild(name); 399 CanonicalName* canonical_name = parent->AddChild(name);
399 canonical_names_[canonical_names_entries_read_] = canonical_name; 400 canonical_names_[canonical_names_entries_read_] = canonical_name;
400 } 401 }
401 402
402 canonical_names_next_offset_ = ReaderOffset(); 403 canonical_names_next_offset_ = ReaderOffset();
403 404
404 SetOffset(saved_offset); 405 SetOffset(saved_offset);
405 return canonical_names_[index]; 406 return canonical_names_[index];
406 } 407 }
407 408
409
408 intptr_t StreamingFlowGraphBuilder::ReaderOffset() { 410 intptr_t StreamingFlowGraphBuilder::ReaderOffset() {
409 return reader_->offset(); 411 return reader_->offset();
410 } 412 }
411 413
414
412 void StreamingFlowGraphBuilder::SetOffset(intptr_t offset) { 415 void StreamingFlowGraphBuilder::SetOffset(intptr_t offset) {
413 reader_->set_offset(offset); 416 reader_->set_offset(offset);
414 } 417 }
415 418
419
416 void StreamingFlowGraphBuilder::SkipBytes(intptr_t bytes) { 420 void StreamingFlowGraphBuilder::SkipBytes(intptr_t bytes) {
417 reader_->set_offset(ReaderOffset() + bytes); 421 reader_->set_offset(ReaderOffset() + bytes);
418 } 422 }
419 423
424
420 uint32_t StreamingFlowGraphBuilder::ReadUInt() { 425 uint32_t StreamingFlowGraphBuilder::ReadUInt() {
421 return reader_->ReadUInt(); 426 return reader_->ReadUInt();
422 } 427 }
423 428
429
424 intptr_t StreamingFlowGraphBuilder::ReadListLength() { 430 intptr_t StreamingFlowGraphBuilder::ReadListLength() {
425 return reader_->ReadListLength(); 431 return reader_->ReadListLength();
426 } 432 }
427 433
434
428 TokenPosition StreamingFlowGraphBuilder::ReadPosition(bool record) { 435 TokenPosition StreamingFlowGraphBuilder::ReadPosition(bool record) {
429 return reader_->ReadPosition(record); 436 return reader_->ReadPosition(record);
430 } 437 }
431 438
439
432 Tag StreamingFlowGraphBuilder::ReadTag(uint8_t* payload) { 440 Tag StreamingFlowGraphBuilder::ReadTag(uint8_t* payload) {
433 return reader_->ReadTag(payload); 441 return reader_->ReadTag(payload);
434 } 442 }
435 443
444
436 CatchBlock* StreamingFlowGraphBuilder::catch_block() { 445 CatchBlock* StreamingFlowGraphBuilder::catch_block() {
437 return flow_graph_builder_->catch_block_; 446 return flow_graph_builder_->catch_block_;
438 } 447 }
439 448
449
440 ScopeBuildingResult* StreamingFlowGraphBuilder::scopes() { 450 ScopeBuildingResult* StreamingFlowGraphBuilder::scopes() {
441 return flow_graph_builder_->scopes_; 451 return flow_graph_builder_->scopes_;
442 } 452 }
443 453
454
444 ParsedFunction* StreamingFlowGraphBuilder::parsed_function() { 455 ParsedFunction* StreamingFlowGraphBuilder::parsed_function() {
445 return flow_graph_builder_->parsed_function_; 456 return flow_graph_builder_->parsed_function_;
446 } 457 }
447 458
459
448 dart::String& StreamingFlowGraphBuilder::DartSymbol(intptr_t index) { 460 dart::String& StreamingFlowGraphBuilder::DartSymbol(intptr_t index) {
449 intptr_t start = GetStringOffset(index); 461 intptr_t start = GetStringOffset(index);
450 intptr_t end = GetStringOffset(index + 1); 462 intptr_t end = GetStringOffset(index + 1);
451 return H.DartSymbol(reader_->buffer() + start, end - start); 463 return H.DartSymbol(reader_->buffer() + reader_->string_data_offset() + start,
464 end - start);
452 } 465 }
453 466
467
454 dart::String& StreamingFlowGraphBuilder::DartString(intptr_t index) { 468 dart::String& StreamingFlowGraphBuilder::DartString(intptr_t index) {
455 intptr_t start = GetStringOffset(index); 469 intptr_t start = GetStringOffset(index);
456 intptr_t end = GetStringOffset(index + 1); 470 intptr_t end = GetStringOffset(index + 1);
457 return H.DartString(reader_->buffer() + start, end - start); 471 return H.DartString(reader_->buffer() + reader_->string_data_offset() + start,
472 end - start);
458 } 473 }
459 474
475
460 String* StreamingFlowGraphBuilder::KernelString(intptr_t index) { 476 String* StreamingFlowGraphBuilder::KernelString(intptr_t index) {
461 intptr_t start = GetStringOffset(index); 477 intptr_t start = GetStringOffset(index);
462 intptr_t end = GetStringOffset(index + 1); 478 intptr_t end = GetStringOffset(index + 1);
463 return new String(reader_->buffer() + start, end - start); 479 return new String(start, end - start);
464 } 480 }
465 481
482
466 Fragment StreamingFlowGraphBuilder::DebugStepCheck(TokenPosition position) { 483 Fragment StreamingFlowGraphBuilder::DebugStepCheck(TokenPosition position) {
467 return flow_graph_builder_->DebugStepCheck(position); 484 return flow_graph_builder_->DebugStepCheck(position);
468 } 485 }
469 486
487
470 Fragment StreamingFlowGraphBuilder::LoadLocal(LocalVariable* variable) { 488 Fragment StreamingFlowGraphBuilder::LoadLocal(LocalVariable* variable) {
471 return flow_graph_builder_->LoadLocal(variable); 489 return flow_graph_builder_->LoadLocal(variable);
472 } 490 }
473 491
492
474 Fragment StreamingFlowGraphBuilder::PushArgument() { 493 Fragment StreamingFlowGraphBuilder::PushArgument() {
475 return flow_graph_builder_->PushArgument(); 494 return flow_graph_builder_->PushArgument();
476 } 495 }
477 496
497
478 Fragment StreamingFlowGraphBuilder::RethrowException(TokenPosition position, 498 Fragment StreamingFlowGraphBuilder::RethrowException(TokenPosition position,
479 int catch_try_index) { 499 int catch_try_index) {
480 return flow_graph_builder_->RethrowException(position, catch_try_index); 500 return flow_graph_builder_->RethrowException(position, catch_try_index);
481 } 501 }
482 502
503
483 Fragment StreamingFlowGraphBuilder::ThrowNoSuchMethodError() { 504 Fragment StreamingFlowGraphBuilder::ThrowNoSuchMethodError() {
484 return flow_graph_builder_->ThrowNoSuchMethodError(); 505 return flow_graph_builder_->ThrowNoSuchMethodError();
485 } 506 }
486 507
508
487 Fragment StreamingFlowGraphBuilder::Constant(const Object& value) { 509 Fragment StreamingFlowGraphBuilder::Constant(const Object& value) {
488 return flow_graph_builder_->Constant(value); 510 return flow_graph_builder_->Constant(value);
489 } 511 }
490 512
513
491 Fragment StreamingFlowGraphBuilder::IntConstant(int64_t value) { 514 Fragment StreamingFlowGraphBuilder::IntConstant(int64_t value) {
492 return flow_graph_builder_->IntConstant(value); 515 return flow_graph_builder_->IntConstant(value);
493 } 516 }
494 517
518
495 Fragment StreamingFlowGraphBuilder::LoadStaticField() { 519 Fragment StreamingFlowGraphBuilder::LoadStaticField() {
496 return flow_graph_builder_->LoadStaticField(); 520 return flow_graph_builder_->LoadStaticField();
497 } 521 }
498 522
523
499 Fragment StreamingFlowGraphBuilder::StaticCall(TokenPosition position, 524 Fragment StreamingFlowGraphBuilder::StaticCall(TokenPosition position,
500 const Function& target, 525 const Function& target,
501 intptr_t argument_count) { 526 intptr_t argument_count) {
502 return flow_graph_builder_->StaticCall(position, target, argument_count); 527 return flow_graph_builder_->StaticCall(position, target, argument_count);
503 } 528 }
504 529
530
505 Fragment StreamingFlowGraphBuilder::BuildInvalidExpression() { 531 Fragment StreamingFlowGraphBuilder::BuildInvalidExpression() {
506 // The frontend will take care of emitting normal errors (like 532 // The frontend will take care of emitting normal errors (like
507 // [NoSuchMethodError]s) and only emit [InvalidExpression]s in very special 533 // [NoSuchMethodError]s) and only emit [InvalidExpression]s in very special
508 // situations (e.g. an invalid annotation). 534 // situations (e.g. an invalid annotation).
509 return ThrowNoSuchMethodError(); 535 return ThrowNoSuchMethodError();
510 } 536 }
511 537
538
512 Fragment StreamingFlowGraphBuilder::BuildStaticGet() { 539 Fragment StreamingFlowGraphBuilder::BuildStaticGet() {
513 intptr_t saved_offset = ReaderOffset() - 1; // Include the tag. 540 intptr_t saved_offset = ReaderOffset() - 1; // Include the tag.
514 TokenPosition position = ReadPosition(); 541 TokenPosition position = ReadPosition();
515 int canonical_name_index = ReadUInt(); 542 int canonical_name_index = ReadUInt();
516 CanonicalName* target = GetCanonicalName(canonical_name_index); 543 CanonicalName* target = GetCanonicalName(canonical_name_index);
517 544
518 if (target->IsField()) { 545 if (H.IsField(target)) {
519 const dart::Field& field = 546 const dart::Field& field =
520 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target)); 547 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target));
521 if (field.is_const()) { 548 if (field.is_const()) {
522 SetOffset(saved_offset); // EvaluateExpression needs the tag. 549 SetOffset(saved_offset); // EvaluateExpression needs the tag.
523 return Constant(constant_evaluator_.EvaluateExpression()); 550 return Constant(constant_evaluator_.EvaluateExpression());
524 } else { 551 } else {
525 const dart::Class& owner = dart::Class::Handle(Z, field.Owner()); 552 const dart::Class& owner = dart::Class::Handle(Z, field.Owner());
526 const dart::String& getter_name = H.DartGetterName(target); 553 const dart::String& getter_name = H.DartGetterName(target);
527 const Function& getter = 554 const Function& getter =
528 Function::ZoneHandle(Z, owner.LookupStaticFunction(getter_name)); 555 Function::ZoneHandle(Z, owner.LookupStaticFunction(getter_name));
529 if (getter.IsNull() || !field.has_initializer()) { 556 if (getter.IsNull() || !field.has_initializer()) {
530 Fragment instructions = Constant(field); 557 Fragment instructions = Constant(field);
531 return instructions + LoadStaticField(); 558 return instructions + LoadStaticField();
532 } else { 559 } else {
533 return StaticCall(position, getter, 0); 560 return StaticCall(position, getter, 0);
534 } 561 }
535 } 562 }
536 } else { 563 } else {
537 const Function& function = 564 const Function& function =
538 Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target)); 565 Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target));
539 566
540 if (target->IsGetter()) { 567 if (H.IsGetter(target)) {
541 return StaticCall(position, function, 0); 568 return StaticCall(position, function, 0);
542 } else if (target->IsMethod()) { 569 } else if (H.IsMethod(target)) {
543 SetOffset(saved_offset); // EvaluateExpression needs the tag. 570 SetOffset(saved_offset); // EvaluateExpression needs the tag.
544 return Constant(constant_evaluator_.EvaluateExpression()); 571 return Constant(constant_evaluator_.EvaluateExpression());
545 } else { 572 } else {
546 UNIMPLEMENTED(); 573 UNIMPLEMENTED();
547 } 574 }
548 } 575 }
549 576
550 return Fragment(); 577 return Fragment();
551 } 578 }
552 579
580
553 Fragment StreamingFlowGraphBuilder::BuildSymbolLiteral() { 581 Fragment StreamingFlowGraphBuilder::BuildSymbolLiteral() {
554 SkipBytes(-1); // EvaluateExpression needs the tag. 582 SkipBytes(-1); // EvaluateExpression needs the tag.
555 return Constant(constant_evaluator_.EvaluateExpression()); 583 return Constant(constant_evaluator_.EvaluateExpression());
556 } 584 }
557 585
586
558 Fragment StreamingFlowGraphBuilder::BuildThisExpression() { 587 Fragment StreamingFlowGraphBuilder::BuildThisExpression() {
559 return LoadLocal(scopes()->this_variable); 588 return LoadLocal(scopes()->this_variable);
560 } 589 }
561 590
591
562 Fragment StreamingFlowGraphBuilder::BuildRethrow() { 592 Fragment StreamingFlowGraphBuilder::BuildRethrow() {
563 TokenPosition position = ReadPosition(); 593 TokenPosition position = ReadPosition();
564 Fragment instructions = DebugStepCheck(position); 594 Fragment instructions = DebugStepCheck(position);
565 instructions += LoadLocal(catch_block()->exception_var()); 595 instructions += LoadLocal(catch_block()->exception_var());
566 instructions += PushArgument(); 596 instructions += PushArgument();
567 instructions += LoadLocal(catch_block()->stack_trace_var()); 597 instructions += LoadLocal(catch_block()->stack_trace_var());
568 instructions += PushArgument(); 598 instructions += PushArgument();
569 instructions += RethrowException(position, catch_block()->catch_try_index()); 599 instructions += RethrowException(position, catch_block()->catch_try_index());
570 600
571 return instructions; 601 return instructions;
572 } 602 }
573 603
604
574 Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral() { 605 Fragment StreamingFlowGraphBuilder::BuildBigIntLiteral() {
575 const dart::String& value = DartString(ReadUInt()); 606 const dart::String& value = DartString(ReadUInt());
576 return Constant(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld))); 607 return Constant(Integer::ZoneHandle(Z, Integer::New(value, Heap::kOld)));
577 } 608 }
578 609
610
579 Fragment StreamingFlowGraphBuilder::BuildStringLiteral() { 611 Fragment StreamingFlowGraphBuilder::BuildStringLiteral() {
580 intptr_t str_index = ReadUInt(); 612 intptr_t str_index = ReadUInt();
581 return Constant(DartSymbol(str_index)); 613 return Constant(DartSymbol(str_index));
582 } 614 }
583 615
616
584 Fragment StreamingFlowGraphBuilder::BuildIntLiteral(uint8_t payload) { 617 Fragment StreamingFlowGraphBuilder::BuildIntLiteral(uint8_t payload) {
585 int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias; 618 int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias;
586 return IntConstant(value); 619 return IntConstant(value);
587 } 620 }
588 621
622
589 Fragment StreamingFlowGraphBuilder::BuildIntLiteral(bool is_negative) { 623 Fragment StreamingFlowGraphBuilder::BuildIntLiteral(bool is_negative) {
590 int64_t value = is_negative ? -static_cast<int64_t>(ReadUInt()) : ReadUInt(); 624 int64_t value = is_negative ? -static_cast<int64_t>(ReadUInt()) : ReadUInt();
591 return IntConstant(value); 625 return IntConstant(value);
592 } 626 }
593 627
628
594 Fragment StreamingFlowGraphBuilder::BuildDoubleLiteral() { 629 Fragment StreamingFlowGraphBuilder::BuildDoubleLiteral() {
595 SkipBytes(-1); // EvaluateExpression needs the tag. 630 SkipBytes(-1); // EvaluateExpression needs the tag.
596 return Constant(constant_evaluator_.EvaluateExpression()); 631 return Constant(constant_evaluator_.EvaluateExpression());
597 } 632 }
598 633
634
599 Fragment StreamingFlowGraphBuilder::BuildBoolLiteral(bool value) { 635 Fragment StreamingFlowGraphBuilder::BuildBoolLiteral(bool value) {
600 return Constant(Bool::Get(value)); 636 return Constant(Bool::Get(value));
601 } 637 }
602 638
639
603 Fragment StreamingFlowGraphBuilder::BuildNullLiteral() { 640 Fragment StreamingFlowGraphBuilder::BuildNullLiteral() {
604 return Constant(Instance::ZoneHandle(Z, Instance::null())); 641 return Constant(Instance::ZoneHandle(Z, Instance::null()));
605 } 642 }
606 643
644
607 } // namespace kernel 645 } // namespace kernel
608 } // namespace dart 646 } // namespace dart
609 647
610 #endif // !defined(DART_PRECOMPILED_RUNTIME) 648 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698