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

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

Issue 2901103004: Experimental code to detect transitive closure of parser code which causes new-space allocations
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | runtime/vm/parser.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 "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/become.h" 10 #include "vm/become.h"
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 #endif 1900 #endif
1901 } 1901 }
1902 1902
1903 1903
1904 RawObject* Object::Allocate(intptr_t cls_id, intptr_t size, Heap::Space space) { 1904 RawObject* Object::Allocate(intptr_t cls_id, intptr_t size, Heap::Space space) {
1905 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 1905 ASSERT(Utils::IsAligned(size, kObjectAlignment));
1906 Thread* thread = Thread::Current(); 1906 Thread* thread = Thread::Current();
1907 Isolate* isolate = thread->isolate(); 1907 Isolate* isolate = thread->isolate();
1908 // New space allocation allowed only in mutator thread (Dart thread); 1908 // New space allocation allowed only in mutator thread (Dart thread);
1909 ASSERT(thread->IsMutatorThread() || (space != Heap::kNew)); 1909 ASSERT(thread->IsMutatorThread() || (space != Heap::kNew));
1910 RELEASE_ASSERT(!thread->IsInsideParser() || (space != Heap::kNew));
1910 ASSERT(thread->no_callback_scope_depth() == 0); 1911 ASSERT(thread->no_callback_scope_depth() == 0);
1911 Heap* heap = isolate->heap(); 1912 Heap* heap = isolate->heap();
1912 1913
1913 uword address = heap->Allocate(size, space); 1914 uword address = heap->Allocate(size, space);
1914 if (address == 0) { 1915 if (address == 0) {
1915 // Use the preallocated out of memory exception to avoid calling 1916 // Use the preallocated out of memory exception to avoid calling
1916 // into dart code or allocating any code. 1917 // into dart code or allocating any code.
1917 const Instance& exception = 1918 const Instance& exception =
1918 Instance::Handle(isolate->object_store()->out_of_memory()); 1919 Instance::Handle(isolate->object_store()->out_of_memory());
1919 Exceptions::Throw(thread, exception); 1920 Exceptions::Throw(thread, exception);
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 src_pieces.Add(expr); 3086 src_pieces.Add(expr);
3086 src_pieces.Add(Symbols::Semicolon()); 3087 src_pieces.Add(Symbols::Semicolon());
3087 return String::ConcatAll(Array::Handle(Array::MakeArray(src_pieces))); 3088 return String::ConcatAll(Array::Handle(Array::MakeArray(src_pieces)));
3088 } 3089 }
3089 3090
3090 3091
3091 RawFunction* Function::EvaluateHelper(const Class& cls, 3092 RawFunction* Function::EvaluateHelper(const Class& cls,
3092 const String& expr, 3093 const String& expr,
3093 const Array& param_names, 3094 const Array& param_names,
3094 bool is_static) { 3095 bool is_static) {
3096 LeaveParserScope _(Thread::Current());
3095 const String& func_src = 3097 const String& func_src =
3096 String::Handle(BuildClosureSource(param_names, expr)); 3098 String::Handle(BuildClosureSource(param_names, expr));
3097 Script& script = Script::Handle(); 3099 Script& script = Script::Handle();
3098 script = 3100 script =
3099 Script::New(Symbols::EvalSourceUri(), func_src, RawScript::kEvaluateTag); 3101 Script::New(Symbols::EvalSourceUri(), func_src, RawScript::kEvaluateTag);
3100 // In order to tokenize the source, we need to get the key to mangle 3102 // In order to tokenize the source, we need to get the key to mangle
3101 // private names from the library from which the class originates. 3103 // private names from the library from which the class originates.
3102 const Library& lib = Library::Handle(cls.library()); 3104 const Library& lib = Library::Handle(cls.library());
3103 ASSERT(!lib.IsNull()); 3105 ASSERT(!lib.IsNull());
3104 const String& lib_key = String::Handle(lib.private_key()); 3106 const String& lib_key = String::Handle(lib.private_key());
(...skipping 20248 matching lines...) Expand 10 before | Expand all | Expand 10 after
23353 return UserTag::null(); 23355 return UserTag::null();
23354 } 23356 }
23355 23357
23356 23358
23357 const char* UserTag::ToCString() const { 23359 const char* UserTag::ToCString() const {
23358 const String& tag_label = String::Handle(label()); 23360 const String& tag_label = String::Handle(label());
23359 return tag_label.ToCString(); 23361 return tag_label.ToCString();
23360 } 23362 }
23361 23363
23362 } // namespace dart 23364 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698