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

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

Issue 194813008: Add compile timestamp to Code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
OLDNEW
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 10227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10238 ASSERT(Object::code_class() != Class::null()); 10238 ASSERT(Object::code_class() != Class::null());
10239 Code& result = Code::Handle(); 10239 Code& result = Code::Handle();
10240 { 10240 {
10241 uword size = Code::InstanceSize(pointer_offsets_length); 10241 uword size = Code::InstanceSize(pointer_offsets_length);
10242 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); 10242 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld);
10243 NoGCScope no_gc; 10243 NoGCScope no_gc;
10244 result ^= raw; 10244 result ^= raw;
10245 result.set_pointer_offsets_length(pointer_offsets_length); 10245 result.set_pointer_offsets_length(pointer_offsets_length);
10246 result.set_is_optimized(false); 10246 result.set_is_optimized(false);
10247 result.set_is_alive(false); 10247 result.set_is_alive(false);
10248 result.set_comments(Comments::New(0)); 10248 result.set_comments(Comments::New(0));
siva 2014/03/11 20:32:08 Should the timestamp be initialized to 0 here.
Cutch 2014/03/11 21:09:15 Done.
10249 result.set_pc_descriptors(Object::empty_descriptors()); 10249 result.set_pc_descriptors(Object::empty_descriptors());
10250 } 10250 }
10251 return result.raw(); 10251 return result.raw();
10252 } 10252 }
10253 10253
10254 10254
10255 RawCode* Code::FinalizeCode(const char* name, 10255 RawCode* Code::FinalizeCode(const char* name,
10256 Assembler* assembler, 10256 Assembler* assembler,
10257 bool optimized) { 10257 bool optimized) {
10258 ASSERT(assembler != NULL); 10258 ASSERT(assembler != NULL);
10259 10259
10260 // Allocate the Code and Instructions objects. Code is allocated first 10260 // Allocate the Code and Instructions objects. Code is allocated first
10261 // because a GC during allocation of the code will leave the instruction 10261 // because a GC during allocation of the code will leave the instruction
10262 // pages read-only. 10262 // pages read-only.
10263 intptr_t pointer_offset_count = assembler->CountPointerOffsets(); 10263 intptr_t pointer_offset_count = assembler->CountPointerOffsets();
10264 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count)); 10264 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count));
10265 Instructions& instrs = 10265 Instructions& instrs =
10266 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); 10266 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize()));
10267 10267
10268 // Copy the instructions into the instruction area and apply all fixups. 10268 // Copy the instructions into the instruction area and apply all fixups.
10269 // Embedded pointers are still in handles at this point. 10269 // Embedded pointers are still in handles at this point.
10270 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), 10270 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()),
10271 instrs.size()); 10271 instrs.size());
10272 assembler->FinalizeInstructions(region); 10272 assembler->FinalizeInstructions(region);
10273 CPU::FlushICache(instrs.EntryPoint(), instrs.size()); 10273 CPU::FlushICache(instrs.EntryPoint(), instrs.size());
10274 10274
10275 code.set_compile_timestamp(OS::GetCurrentTimeMicros());
10275 CodeObservers::NotifyAll(name, 10276 CodeObservers::NotifyAll(name,
10276 instrs.EntryPoint(), 10277 instrs.EntryPoint(),
10277 assembler->prologue_offset(), 10278 assembler->prologue_offset(),
10278 instrs.size(), 10279 instrs.size(),
10279 optimized); 10280 optimized);
10280 10281
10281 { 10282 {
10282 NoGCScope no_gc; 10283 NoGCScope no_gc;
10283 const ZoneGrowableArray<intptr_t>& pointer_offsets = 10284 const ZoneGrowableArray<intptr_t>& pointer_offsets =
10284 assembler->GetPointerOffsets(); 10285 assembler->GetPointerOffsets();
(...skipping 7294 matching lines...) Expand 10 before | Expand all | Expand 10 after
17579 return "_MirrorReference"; 17580 return "_MirrorReference";
17580 } 17581 }
17581 17582
17582 17583
17583 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17584 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17584 Instance::PrintToJSONStream(stream, ref); 17585 Instance::PrintToJSONStream(stream, ref);
17585 } 17586 }
17586 17587
17587 17588
17588 } // namespace dart 17589 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698