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

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

Issue 138913016: Fix flag to switch write protection of code pages on/off. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed test to match expectation Created 6 years, 10 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 | « no previous file | runtime/vm/object_test.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 "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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); 63 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache");
64 64
65 DECLARE_FLAG(bool, eliminate_type_checks); 65 DECLARE_FLAG(bool, eliminate_type_checks);
66 DECLARE_FLAG(bool, enable_type_checks); 66 DECLARE_FLAG(bool, enable_type_checks);
67 DECLARE_FLAG(bool, error_on_bad_override); 67 DECLARE_FLAG(bool, error_on_bad_override);
68 DECLARE_FLAG(bool, trace_compiler); 68 DECLARE_FLAG(bool, trace_compiler);
69 DECLARE_FLAG(bool, trace_deoptimization); 69 DECLARE_FLAG(bool, trace_deoptimization);
70 DECLARE_FLAG(bool, trace_deoptimization_verbose); 70 DECLARE_FLAG(bool, trace_deoptimization_verbose);
71 DECLARE_FLAG(bool, verbose_stacktrace); 71 DECLARE_FLAG(bool, verbose_stacktrace);
72 DECLARE_FLAG(charp, coverage_dir); 72 DECLARE_FLAG(charp, coverage_dir);
73 DECLARE_FLAG(bool, write_protect_code);
73 74
74 static const char* kGetterPrefix = "get:"; 75 static const char* kGetterPrefix = "get:";
75 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); 76 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix);
76 static const char* kSetterPrefix = "set:"; 77 static const char* kSetterPrefix = "set:";
77 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); 78 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
78 79
79 cpp_vtable Object::handle_vtable_ = 0; 80 cpp_vtable Object::handle_vtable_ = 0;
80 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; 81 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 };
81 cpp_vtable Smi::handle_vtable_ = 0; 82 cpp_vtable Smi::handle_vtable_ = 0;
82 83
(...skipping 10138 matching lines...) Expand 10 before | Expand all | Expand 10 after
10221 instrs.set_object_pool(Object::empty_array().raw()); 10222 instrs.set_object_pool(Object::empty_array().raw());
10222 } else { 10223 } else {
10223 // TODO(regis): Once MakeArray takes a Heap::Space argument, call it here 10224 // TODO(regis): Once MakeArray takes a Heap::Space argument, call it here
10224 // with Heap::kOld and change the ARM and MIPS assemblers to work with a 10225 // with Heap::kOld and change the ARM and MIPS assemblers to work with a
10225 // GrowableObjectArray in new space. 10226 // GrowableObjectArray in new space.
10226 instrs.set_object_pool(Array::MakeArray(object_pool)); 10227 instrs.set_object_pool(Array::MakeArray(object_pool));
10227 } 10228 }
10228 bool status = 10229 bool status =
10229 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.raw_ptr()), 10230 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.raw_ptr()),
10230 instrs.raw()->Size(), 10231 instrs.raw()->Size(),
10231 VirtualMemory::kReadExecute); 10232 FLAG_write_protect_code
10233 ? VirtualMemory::kReadExecute
10234 : VirtualMemory::kReadWriteExecute);
10232 ASSERT(status); 10235 ASSERT(status);
10233 } 10236 }
10234 return code.raw(); 10237 return code.raw();
10235 } 10238 }
10236 10239
10237 10240
10238 RawCode* Code::FinalizeCode(const Function& function, 10241 RawCode* Code::FinalizeCode(const Function& function,
10239 Assembler* assembler, 10242 Assembler* assembler,
10240 bool optimized) { 10243 bool optimized) {
10241 // Calling ToFullyQualifiedCString is very expensive, try to avoid it. 10244 // Calling ToFullyQualifiedCString is very expensive, try to avoid it.
(...skipping 7114 matching lines...) Expand 10 before | Expand all | Expand 10 after
17356 return "_MirrorReference"; 17359 return "_MirrorReference";
17357 } 17360 }
17358 17361
17359 17362
17360 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17363 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17361 Instance::PrintToJSONStream(stream, ref); 17364 Instance::PrintToJSONStream(stream, ref);
17362 } 17365 }
17363 17366
17364 17367
17365 } // namespace dart 17368 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698