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

Side by Side Diff: src/snapshot/snapshot-common.cc

Issue 1179893002: Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Factor out Variable::HasThisName Created 5 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 | « src/scopes.h ('k') | src/variables.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // The common functionality when building with or without snapshots. 5 // The common functionality when building with or without snapshots.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 Vector<const byte> context_data = ExtractContextData(blob); 70 Vector<const byte> context_data = ExtractContextData(blob);
71 SnapshotData snapshot_data(context_data); 71 SnapshotData snapshot_data(context_data);
72 Deserializer deserializer(&snapshot_data); 72 Deserializer deserializer(&snapshot_data);
73 73
74 MaybeHandle<Object> maybe_context = deserializer.DeserializePartial( 74 MaybeHandle<Object> maybe_context = deserializer.DeserializePartial(
75 isolate, global_proxy, outdated_contexts_out); 75 isolate, global_proxy, outdated_contexts_out);
76 Handle<Object> result; 76 Handle<Object> result;
77 if (!maybe_context.ToHandle(&result)) return MaybeHandle<Context>(); 77 if (!maybe_context.ToHandle(&result)) return MaybeHandle<Context>();
78 CHECK(result->IsContext()); 78 CHECK(result->IsContext());
79 // If the snapshot does not contain a custom script, we need to update 79 // If the snapshot does not contain a custom script, we need to update
80 // the global object for exactly one context. 80 // the global object for exactly two contexts: the builtins context and the
81 CHECK(EmbedsScript(isolate) || (*outdated_contexts_out)->length() == 1); 81 // script context that has the global "this" binding.
82 CHECK(EmbedsScript(isolate) || (*outdated_contexts_out)->length() == 2);
82 if (FLAG_profile_deserialization) { 83 if (FLAG_profile_deserialization) {
83 double ms = timer.Elapsed().InMillisecondsF(); 84 double ms = timer.Elapsed().InMillisecondsF();
84 int bytes = context_data.length(); 85 int bytes = context_data.length();
85 PrintF("[Deserializing context (%d bytes) took %0.3f ms]\n", bytes, ms); 86 PrintF("[Deserializing context (%d bytes) took %0.3f ms]\n", bytes, ms);
86 } 87 }
87 return Handle<Context>::cast(result); 88 return Handle<Context>::cast(result);
88 } 89 }
89 90
90 91
91 void CalculateFirstPageSizes(bool is_default_snapshot, 92 void CalculateFirstPageSizes(bool is_default_snapshot,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); 222 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize);
222 int context_offset = ContextOffset(startup_length); 223 int context_offset = ContextOffset(startup_length);
223 const byte* context_data = 224 const byte* context_data =
224 reinterpret_cast<const byte*>(data->data + context_offset); 225 reinterpret_cast<const byte*>(data->data + context_offset);
225 DCHECK_LT(context_offset, data->raw_size); 226 DCHECK_LT(context_offset, data->raw_size);
226 int context_length = data->raw_size - context_offset; 227 int context_length = data->raw_size - context_offset;
227 return Vector<const byte>(context_data, context_length); 228 return Vector<const byte>(context_data, context_length);
228 } 229 }
229 } // namespace internal 230 } // namespace internal
230 } // namespace v8 231 } // namespace v8
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698