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

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

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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/snapshot/snapshot.h" 7 #include "src/snapshot/snapshot.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SnapshotData snapshot_data(context_data); 77 SnapshotData snapshot_data(context_data);
78 Deserializer deserializer(&snapshot_data); 78 Deserializer deserializer(&snapshot_data);
79 79
80 MaybeHandle<Object> maybe_context = deserializer.DeserializePartial( 80 MaybeHandle<Object> maybe_context = deserializer.DeserializePartial(
81 isolate, global_proxy, outdated_contexts_out); 81 isolate, global_proxy, outdated_contexts_out);
82 Handle<Object> result; 82 Handle<Object> result;
83 if (!maybe_context.ToHandle(&result)) return MaybeHandle<Context>(); 83 if (!maybe_context.ToHandle(&result)) return MaybeHandle<Context>();
84 CHECK(result->IsContext()); 84 CHECK(result->IsContext());
85 // If the snapshot does not contain a custom script, we need to update 85 // If the snapshot does not contain a custom script, we need to update
86 // the global object for exactly two contexts: the builtins context and the 86 // the global object for exactly two contexts: the builtins context and the
87 // script context that has the global "this" binding. 87 // script context that has the global "this" binding.
Yang 2015/11/27 12:28:20 Also remove comment.
88 CHECK(EmbedsScript(isolate) || (*outdated_contexts_out)->length() == 2);
89 if (FLAG_profile_deserialization) { 88 if (FLAG_profile_deserialization) {
90 double ms = timer.Elapsed().InMillisecondsF(); 89 double ms = timer.Elapsed().InMillisecondsF();
91 int bytes = context_data.length(); 90 int bytes = context_data.length();
92 PrintF("[Deserializing context (%d bytes) took %0.3f ms]\n", bytes, ms); 91 PrintF("[Deserializing context (%d bytes) took %0.3f ms]\n", bytes, ms);
93 } 92 }
94 return Handle<Context>::cast(result); 93 return Handle<Context>::cast(result);
95 } 94 }
96 95
97 96
98 void CalculateFirstPageSizes(bool is_default_snapshot, 97 void CalculateFirstPageSizes(bool is_default_snapshot,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize); 227 memcpy(&startup_length, data->data + kStartupLengthOffset, kIntSize);
229 int context_offset = ContextOffset(startup_length); 228 int context_offset = ContextOffset(startup_length);
230 const byte* context_data = 229 const byte* context_data =
231 reinterpret_cast<const byte*>(data->data + context_offset); 230 reinterpret_cast<const byte*>(data->data + context_offset);
232 DCHECK_LT(context_offset, data->raw_size); 231 DCHECK_LT(context_offset, data->raw_size);
233 int context_length = data->raw_size - context_offset; 232 int context_length = data->raw_size - context_offset;
234 return Vector<const byte>(context_data, context_length); 233 return Vector<const byte>(context_data, context_length);
235 } 234 }
236 } // namespace internal 235 } // namespace internal
237 } // namespace v8 236 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698