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

Side by Side Diff: src/bootstrapper.cc

Issue 604373008: Serialize all external strings except for native source code strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « include/v8.h ('k') | src/heap/heap.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/extensions/externalize-string-extension.h" 9 #include "src/extensions/externalize-string-extension.h"
10 #include "src/extensions/free-buffer-extension.h" 10 #include "src/extensions/free-buffer-extension.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // We can use external strings for the natives. 50 // We can use external strings for the natives.
51 Vector<const char> source = Natives::GetRawScriptSource(index); 51 Vector<const char> source = Natives::GetRawScriptSource(index);
52 NativesExternalStringResource* resource = 52 NativesExternalStringResource* resource =
53 new NativesExternalStringResource(this, 53 new NativesExternalStringResource(this,
54 source.start(), 54 source.start(),
55 source.length()); 55 source.length());
56 // We do not expect this to throw an exception. Change this if it does. 56 // We do not expect this to throw an exception. Change this if it does.
57 Handle<String> source_code = isolate_->factory() 57 Handle<String> source_code = isolate_->factory()
58 ->NewExternalStringFromOneByte(resource) 58 ->NewExternalStringFromOneByte(resource)
59 .ToHandleChecked(); 59 .ToHandleChecked();
60 // Mark this external string with a special map.
61 source_code->set_map(isolate_->heap()->native_source_string_map());
60 heap->natives_source_cache()->set(index, *source_code); 62 heap->natives_source_cache()->set(index, *source_code);
61 } 63 }
62 Handle<Object> cached_source(heap->natives_source_cache()->get(index), 64 Handle<Object> cached_source(heap->natives_source_cache()->get(index),
63 isolate_); 65 isolate_);
64 return Handle<String>::cast(cached_source); 66 return Handle<String>::cast(cached_source);
65 } 67 }
66 68
67 69
68 void Bootstrapper::Initialize(bool create_heap_objects) { 70 void Bootstrapper::Initialize(bool create_heap_objects) {
69 extensions_cache_.Initialize(isolate_, create_heap_objects); 71 extensions_cache_.Initialize(isolate_, create_heap_objects);
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 return from + sizeof(NestingCounterType); 2735 return from + sizeof(NestingCounterType);
2734 } 2736 }
2735 2737
2736 2738
2737 // Called when the top-level V8 mutex is destroyed. 2739 // Called when the top-level V8 mutex is destroyed.
2738 void Bootstrapper::FreeThreadResources() { 2740 void Bootstrapper::FreeThreadResources() {
2739 DCHECK(!IsActive()); 2741 DCHECK(!IsActive());
2740 } 2742 }
2741 2743
2742 } } // namespace v8::internal 2744 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698