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

Side by Side Diff: vm/object.cc

Issue 10409038: Remove the special stub code region as we don't need it anymore. With the new frame layout conventi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « vm/object.h ('k') | vm/stub_code.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) 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 5646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 if (!error.IsNull()) { 5657 if (!error.IsNull()) {
5658 return error.raw(); 5658 return error.raw();
5659 } 5659 }
5660 } 5660 }
5661 lib = lib.next_registered(); 5661 lib = lib.next_registered();
5662 } 5662 }
5663 return error.raw(); 5663 return error.raw();
5664 } 5664 }
5665 5665
5666 5666
5667 RawInstructions* Instructions::New(intptr_t size, Heap::Space space) { 5667 RawInstructions* Instructions::New(intptr_t size) {
5668 ASSERT(space == Heap::kDartCode || space == Heap::kStubCode);
5669 const Class& instructions_class = Class::Handle(Object::instructions_class()); 5668 const Class& instructions_class = Class::Handle(Object::instructions_class());
5670 Instructions& result = Instructions::Handle(); 5669 Instructions& result = Instructions::Handle();
5671 { 5670 {
5672 uword aligned_size = Instructions::InstanceSize(size); 5671 uword aligned_size = Instructions::InstanceSize(size);
5673 RawObject* raw = Object::Allocate(instructions_class, aligned_size, space); 5672 RawObject* raw = Object::Allocate(instructions_class,
5673 aligned_size,
5674 Heap::kCode);
5674 NoGCScope no_gc; 5675 NoGCScope no_gc;
5675 // TODO(iposva): Remove premarking once old and code spaces are merged. 5676 // TODO(iposva): Remove premarking once old and code spaces are merged.
5676 raw->SetMarkBit(); 5677 raw->SetMarkBit();
5677 result ^= raw; 5678 result ^= raw;
5678 result.set_size(size); 5679 result.set_size(size);
5679 } 5680 }
5680 return result.raw(); 5681 return result.raw();
5681 } 5682 }
5682 5683
5683 5684
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
6141 NoGCScope no_gc; 6142 NoGCScope no_gc;
6142 result ^= raw; 6143 result ^= raw;
6143 result.set_pointer_offsets_length(pointer_offsets_length); 6144 result.set_pointer_offsets_length(pointer_offsets_length);
6144 result.set_is_optimized(false); 6145 result.set_is_optimized(false);
6145 result.set_comments(Comments::New(0)); 6146 result.set_comments(Comments::New(0));
6146 } 6147 }
6147 return result.raw(); 6148 return result.raw();
6148 } 6149 }
6149 6150
6150 6151
6151 RawCode* Code::FinalizeCode(const char* name, 6152 RawCode* Code::FinalizeCode(const char* name, Assembler* assembler) {
6152 Assembler* assembler,
6153 Heap::Space space) {
6154 ASSERT(assembler != NULL); 6153 ASSERT(assembler != NULL);
6155 6154
6156 // Allocate the Instructions object. 6155 // Allocate the Instructions object.
6157 Instructions& instrs = 6156 Instructions& instrs =
6158 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize(), space)); 6157 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize()));
6159 6158
6160 // Copy the instructions into the instruction area and apply all fixups. 6159 // Copy the instructions into the instruction area and apply all fixups.
6161 // Embedded pointers are still in handles at this point. 6160 // Embedded pointers are still in handles at this point.
6162 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), 6161 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()),
6163 instrs.size()); 6162 instrs.size());
6164 assembler->FinalizeInstructions(region); 6163 assembler->FinalizeInstructions(region);
6165 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator(); 6164 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator();
6166 if (pprof_symbol_generator != NULL) { 6165 if (pprof_symbol_generator != NULL) {
6167 ASSERT(strlen(name) != 0); 6166 ASSERT(strlen(name) != 0);
6168 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size()); 6167 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
6215 instrs.set_code(code.raw()); 6214 instrs.set_code(code.raw());
6216 code.set_instructions(instrs.raw()); 6215 code.set_instructions(instrs.raw());
6217 } 6216 }
6218 return code.raw(); 6217 return code.raw();
6219 } 6218 }
6220 6219
6221 6220
6222 RawCode* Code::FinalizeCode(const Function& function, Assembler* assembler) { 6221 RawCode* Code::FinalizeCode(const Function& function, Assembler* assembler) {
6223 // Calling ToFullyQualifiedCString is very expensive, try to avoid it. 6222 // Calling ToFullyQualifiedCString is very expensive, try to avoid it.
6224 if (FLAG_generate_gdb_symbols || (Dart::pprof_symbol_generator() != NULL)) { 6223 if (FLAG_generate_gdb_symbols || (Dart::pprof_symbol_generator() != NULL)) {
6225 return FinalizeCode(function.ToFullyQualifiedCString(), 6224 return FinalizeCode(function.ToFullyQualifiedCString(), assembler);
6226 assembler,
6227 Heap::kDartCode);
6228 } else { 6225 } else {
6229 return FinalizeCode("", assembler, Heap::kDartCode); 6226 return FinalizeCode("", assembler);
6230 } 6227 }
6231 } 6228 }
6232 6229
6233 6230
6234 RawCode* Code::FinalizeStubCode(const char* name, Assembler* assembler) {
6235 return FinalizeCode(name, assembler, Heap::kStubCode);
6236 }
6237
6238
6239 // Check if object matches find condition. 6231 // Check if object matches find condition.
6240 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { 6232 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) {
6241 return RawInstructions::ContainsPC(obj, pc_); 6233 return RawInstructions::ContainsPC(obj, pc_);
6242 } 6234 }
6243 6235
6244 6236
6245 RawCode* Code::LookupCode(uword pc) { 6237 RawCode* Code::LookupCode(uword pc) {
6246 Isolate* isolate = Isolate::Current(); 6238 Isolate* isolate = Isolate::Current();
6247 NoGCScope no_gc; 6239 NoGCScope no_gc;
6248 FindRawCodeVisitor visitor(pc); 6240 FindRawCodeVisitor visitor(pc);
6249 RawInstructions* instr; 6241 RawInstructions* instr;
6250 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); 6242 instr = isolate->heap()->FindObjectInCodeSpace(&visitor);
6251 if (instr != Instructions::null()) { 6243 if (instr != Instructions::null()) {
6252 return instr->ptr()->code_; 6244 return instr->ptr()->code_;
6253 } 6245 }
6254 instr = isolate->heap()->FindObjectInStubCodeSpace(&visitor);
6255 if (instr != Instructions::null()) {
6256 return instr->ptr()->code_;
6257 }
6258 return Code::null(); 6246 return Code::null();
6259 } 6247 }
6260 6248
6261 6249
6262 intptr_t Code::GetTokenIndexOfPC(uword pc) const { 6250 intptr_t Code::GetTokenIndexOfPC(uword pc) const {
6263 intptr_t token_index = -1; 6251 intptr_t token_index = -1;
6264 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 6252 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
6265 for (intptr_t i = 0; i < descriptors.Length(); i++) { 6253 for (intptr_t i = 0; i < descriptors.Length(); i++) {
6266 if (descriptors.PC(i) == pc) { 6254 if (descriptors.PC(i) == pc) {
6267 token_index = descriptors.TokenIndex(i); 6255 token_index = descriptors.TokenIndex(i);
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after
9999 const String& str = String::Handle(pattern()); 9987 const String& str = String::Handle(pattern());
10000 const char* format = "JSRegExp: pattern=%s flags=%s"; 9988 const char* format = "JSRegExp: pattern=%s flags=%s";
10001 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 9989 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10002 char* chars = reinterpret_cast<char*>( 9990 char* chars = reinterpret_cast<char*>(
10003 Isolate::Current()->current_zone()->Allocate(len + 1)); 9991 Isolate::Current()->current_zone()->Allocate(len + 1));
10004 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 9992 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10005 return chars; 9993 return chars;
10006 } 9994 }
10007 9995
10008 } // namespace dart 9996 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/stub_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698