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

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

Issue 1012333002: Keep zone cached in SnapshotReader to allow removing ZoneHandle(Isolate*) interface. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/constant_propagator.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) 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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 const String& error_message = String::ZoneHandle( 624 const String& error_message = String::ZoneHandle(
625 Symbols::New(error.ToErrorCString())); 625 Symbols::New(error.ToErrorCString()));
626 Exceptions::CreateAndThrowTypeError( 626 Exceptions::CreateAndThrowTypeError(
627 location, src_type_name, dst_type_name, dst_name, error_message); 627 location, src_type_name, dst_type_name, dst_name, error_message);
628 UNREACHABLE(); 628 UNREACHABLE();
629 } 629 }
630 630
631 631
632 DEFINE_RUNTIME_ENTRY(Throw, 1) { 632 DEFINE_RUNTIME_ENTRY(Throw, 1) {
633 const Instance& exception = 633 const Instance& exception =
634 Instance::CheckedHandle(isolate, arguments.ArgAt(0)); 634 Instance::CheckedHandle(zone, arguments.ArgAt(0));
635 Exceptions::Throw(isolate, exception); 635 Exceptions::Throw(isolate, exception);
636 } 636 }
637 637
638 638
639 DEFINE_RUNTIME_ENTRY(ReThrow, 2) { 639 DEFINE_RUNTIME_ENTRY(ReThrow, 2) {
640 const Instance& exception = 640 const Instance& exception =
641 Instance::CheckedHandle(isolate, arguments.ArgAt(0)); 641 Instance::CheckedHandle(zone, arguments.ArgAt(0));
642 const Instance& stacktrace = 642 const Instance& stacktrace =
643 Instance::CheckedHandle(isolate, arguments.ArgAt(1)); 643 Instance::CheckedHandle(zone, arguments.ArgAt(1));
644 Exceptions::ReThrow(isolate, exception, stacktrace); 644 Exceptions::ReThrow(isolate, exception, stacktrace);
645 } 645 }
646 646
647 647
648 // Patches static call in optimized code with the target's entry point. 648 // Patches static call in optimized code with the target's entry point.
649 // Compiles target if necessary. 649 // Compiles target if necessary.
650 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) { 650 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
651 DartFrameIterator iterator; 651 DartFrameIterator iterator;
652 StackFrame* caller_frame = iterator.NextFrame(); 652 StackFrame* caller_frame = iterator.NextFrame();
653 ASSERT(caller_frame != NULL); 653 ASSERT(caller_frame != NULL);
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 function.usage_counter(), 1290 function.usage_counter(),
1291 ic_data.NumberOfChecks(), 1291 ic_data.NumberOfChecks(),
1292 function.ToFullyQualifiedCString()); 1292 function.ToFullyQualifiedCString());
1293 } 1293 }
1294 1294
1295 1295
1296 // This is called from function that needs to be optimized. 1296 // This is called from function that needs to be optimized.
1297 // The requesting function can be already optimized (reoptimization). 1297 // The requesting function can be already optimized (reoptimization).
1298 // Returns the Code object where to continue execution. 1298 // Returns the Code object where to continue execution.
1299 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { 1299 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
1300 const Function& function = Function::CheckedHandle(isolate, 1300 const Function& function = Function::CheckedHandle(zone,
1301 arguments.ArgAt(0)); 1301 arguments.ArgAt(0));
1302 ASSERT(!function.IsNull()); 1302 ASSERT(!function.IsNull());
1303 ASSERT(function.HasCode()); 1303 ASSERT(function.HasCode());
1304 1304
1305 if (CanOptimizeFunction(function, isolate)) { 1305 if (CanOptimizeFunction(function, isolate)) {
1306 // Reset usage counter for reoptimization before calling optimizer to 1306 // Reset usage counter for reoptimization before calling optimizer to
1307 // prevent recursive triggering of function optimization. 1307 // prevent recursive triggering of function optimization.
1308 function.set_usage_counter(0); 1308 function.set_usage_counter(0);
1309 const Error& error = Error::Handle( 1309 const Error& error = Error::Handle(
1310 isolate, Compiler::CompileOptimizedFunction(thread, function)); 1310 isolate, Compiler::CompileOptimizedFunction(thread, function));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 if (frame->IsEntryFrame()) { 1386 if (frame->IsEntryFrame()) {
1387 // There must be a valid Dart frame. 1387 // There must be a valid Dart frame.
1388 UNREACHABLE(); 1388 UNREACHABLE();
1389 } 1389 }
1390 ASSERT(frame->IsDartFrame()); 1390 ASSERT(frame->IsDartFrame());
1391 const Code& caller_code = Code::Handle(isolate, frame->LookupDartCode()); 1391 const Code& caller_code = Code::Handle(isolate, frame->LookupDartCode());
1392 ASSERT(!caller_code.IsNull()); 1392 ASSERT(!caller_code.IsNull());
1393 const uword target = 1393 const uword target =
1394 CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code); 1394 CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code);
1395 const Code& stub = Code::Handle(isolate, Code::LookupCode(target)); 1395 const Code& stub = Code::Handle(isolate, Code::LookupCode(target));
1396 Class& alloc_class = Class::ZoneHandle(isolate); 1396 Class& alloc_class = Class::ZoneHandle(zone);
1397 alloc_class ^= stub.owner(); 1397 alloc_class ^= stub.owner();
1398 Code& alloc_stub = Code::Handle(isolate, alloc_class.allocation_stub()); 1398 Code& alloc_stub = Code::Handle(isolate, alloc_class.allocation_stub());
1399 if (alloc_stub.IsNull()) { 1399 if (alloc_stub.IsNull()) {
1400 alloc_stub = isolate->stub_code()->GetAllocationStubForClass(alloc_class); 1400 alloc_stub = isolate->stub_code()->GetAllocationStubForClass(alloc_class);
1401 ASSERT(!CodePatcher::IsEntryPatched(alloc_stub)); 1401 ASSERT(!CodePatcher::IsEntryPatched(alloc_stub));
1402 } 1402 }
1403 const Instructions& instrs = 1403 const Instructions& instrs =
1404 Instructions::Handle(isolate, caller_code.instructions()); 1404 Instructions::Handle(isolate, caller_code.instructions());
1405 { 1405 {
1406 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); 1406 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1673 const intptr_t elm_size = old_data.ElementSizeInBytes();
1674 const TypedData& new_data = 1674 const TypedData& new_data =
1675 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1675 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1676 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1676 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1677 typed_data_cell.SetAt(0, new_data); 1677 typed_data_cell.SetAt(0, new_data);
1678 arguments.SetReturn(new_data); 1678 arguments.SetReturn(new_data);
1679 } 1679 }
1680 1680
1681 1681
1682 } // namespace dart 1682 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698