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

Side by Side Diff: vm/object.cc

Issue 10223015: Add a stub_code_space in the heap alongside code_space so that stub code generation happens here an… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | Annotate | Revision Log
« vm/heap.cc ('K') | « vm/object.h ('k') | vm/stack_frame.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) 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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 5465 matching lines...) Expand 10 before | Expand all | Expand 10 after
5476 if (!error.IsNull()) { 5476 if (!error.IsNull()) {
5477 return error.raw(); 5477 return error.raw();
5478 } 5478 }
5479 } 5479 }
5480 lib = lib.next_registered(); 5480 lib = lib.next_registered();
5481 } 5481 }
5482 return error.raw(); 5482 return error.raw();
5483 } 5483 }
5484 5484
5485 5485
5486 RawInstructions* Instructions::New(intptr_t size) { 5486 RawInstructions* Instructions::New(intptr_t size, Heap::Space space) {
5487 ASSERT(space == Heap::kDartCode || space == Heap::kStubCode);
5487 const Class& instructions_class = Class::Handle(Object::instructions_class()); 5488 const Class& instructions_class = Class::Handle(Object::instructions_class());
5488 Instructions& result = Instructions::Handle(); 5489 Instructions& result = Instructions::Handle();
5489 { 5490 {
5490 uword aligned_size = Instructions::InstanceSize(size); 5491 uword aligned_size = Instructions::InstanceSize(size);
5491 RawObject* raw = Object::Allocate(instructions_class, 5492 RawObject* raw = Object::Allocate(instructions_class, aligned_size, space);
5492 aligned_size,
5493 Heap::kExecutable);
5494 NoGCScope no_gc; 5493 NoGCScope no_gc;
5495 result ^= raw; 5494 result ^= raw;
5496 result.set_size(size); 5495 result.set_size(size);
5497 } 5496 }
5498 return result.raw(); 5497 return result.raw();
5499 } 5498 }
5500 5499
5501 5500
5502 const char* Instructions::ToCString() const { 5501 const char* Instructions::ToCString() const {
5503 return "Instructions"; 5502 return "Instructions";
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
5904 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); 5903 RawObject* raw = Object::Allocate(cls, size, Heap::kOld);
5905 NoGCScope no_gc; 5904 NoGCScope no_gc;
5906 result ^= raw; 5905 result ^= raw;
5907 result.set_pointer_offsets_length(pointer_offsets_length); 5906 result.set_pointer_offsets_length(pointer_offsets_length);
5908 result.set_is_optimized(false); 5907 result.set_is_optimized(false);
5909 } 5908 }
5910 return result.raw(); 5909 return result.raw();
5911 } 5910 }
5912 5911
5913 5912
5914 RawCode* Code::FinalizeCode(const char* name, Assembler* assembler) { 5913 RawCode* Code::FinalizeCode(const char* name,
5914 Assembler* assembler,
5915 Heap::Space space) {
5915 ASSERT(assembler != NULL); 5916 ASSERT(assembler != NULL);
5916 5917
5917 // Allocate the Instructions object. 5918 // Allocate the Instructions object.
5918 Instructions& instrs = 5919 Instructions& instrs =
5919 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); 5920 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize(), space));
5920 5921
5921 // Copy the instructions into the instruction area and apply all fixups. 5922 // Copy the instructions into the instruction area and apply all fixups.
5922 // Embedded pointers are still in handles at this point. 5923 // Embedded pointers are still in handles at this point.
5923 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), 5924 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()),
5924 instrs.size()); 5925 instrs.size());
5925 assembler->FinalizeInstructions(region); 5926 assembler->FinalizeInstructions(region);
5926 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator(); 5927 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator();
5927 if (pprof_symbol_generator != NULL) { 5928 if (pprof_symbol_generator != NULL) {
5928 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size()); 5929 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size());
5929 pprof_symbol_generator->AddCodeRegion(name, 5930 pprof_symbol_generator->AddCodeRegion(name,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5971 } 5972 }
5972 5973
5973 // Hook up Code and Instruction objects. 5974 // Hook up Code and Instruction objects.
5974 instrs.set_code(code.raw()); 5975 instrs.set_code(code.raw());
5975 code.set_instructions(instrs.raw()); 5976 code.set_instructions(instrs.raw());
5976 } 5977 }
5977 return code.raw(); 5978 return code.raw();
5978 } 5979 }
5979 5980
5980 5981
5982 RawCode* Code::FinalizeCode(const char* name, Assembler* assembler) {
5983 return FinalizeCode(name, assembler, Heap::kDartCode);
5984 }
5985
5986
5987 RawCode* Code::FinalizeStubCode(const char* name, Assembler* assembler) {
5988 return FinalizeCode(name, assembler, Heap::kStubCode);
5989 }
5990
5991
5981 intptr_t Code::GetTokenIndexOfPC(uword pc) const { 5992 intptr_t Code::GetTokenIndexOfPC(uword pc) const {
5982 intptr_t token_index = -1; 5993 intptr_t token_index = -1;
5983 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 5994 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
5984 for (intptr_t i = 0; i < descriptors.Length(); i++) { 5995 for (intptr_t i = 0; i < descriptors.Length(); i++) {
5985 if (descriptors.PC(i) == pc) { 5996 if (descriptors.PC(i) == pc) {
5986 token_index = descriptors.TokenIndex(i); 5997 token_index = descriptors.TokenIndex(i);
5987 break; 5998 break;
5988 } 5999 }
5989 } 6000 }
5990 return token_index; 6001 return token_index;
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
9233 const String& str = String::Handle(pattern()); 9244 const String& str = String::Handle(pattern());
9234 const char* format = "JSRegExp: pattern=%s flags=%s"; 9245 const char* format = "JSRegExp: pattern=%s flags=%s";
9235 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 9246 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
9236 char* chars = reinterpret_cast<char*>( 9247 char* chars = reinterpret_cast<char*>(
9237 Isolate::Current()->current_zone()->Allocate(len + 1)); 9248 Isolate::Current()->current_zone()->Allocate(len + 1));
9238 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 9249 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
9239 return chars; 9250 return chars;
9240 } 9251 }
9241 9252
9242 } // namespace dart 9253 } // namespace dart
OLDNEW
« vm/heap.cc ('K') | « vm/object.h ('k') | vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698