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

Side by Side Diff: src/snapshot/partial-serializer.cc

Issue 2402363002: [Math] implement Math.random as TFJ builtin. (Closed)
Patch Set: fix golden file Created 4 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/snapshot/partial-serializer.h" 5 #include "src/snapshot/partial-serializer.h"
6 #include "src/snapshot/startup-serializer.h" 6 #include "src/snapshot/startup-serializer.h"
7 7
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 15 matching lines...) Expand all
26 reference_map()->AddAttachedReference(context->global_proxy()); 26 reference_map()->AddAttachedReference(context->global_proxy());
27 // The bootstrap snapshot has a code-stub context. When serializing the 27 // The bootstrap snapshot has a code-stub context. When serializing the
28 // partial snapshot, it is chained into the weak context list on the isolate 28 // partial snapshot, it is chained into the weak context list on the isolate
29 // and it's next context pointer may point to the code-stub context. Clear 29 // and it's next context pointer may point to the code-stub context. Clear
30 // it before serializing, it will get re-added to the context list 30 // it before serializing, it will get re-added to the context list
31 // explicitly when it's loaded. 31 // explicitly when it's loaded.
32 if (context->IsNativeContext()) { 32 if (context->IsNativeContext()) {
33 context->set(Context::NEXT_CONTEXT_LINK, 33 context->set(Context::NEXT_CONTEXT_LINK,
34 isolate_->heap()->undefined_value()); 34 isolate_->heap()->undefined_value());
35 DCHECK(!context->global_object()->IsUndefined(context->GetIsolate())); 35 DCHECK(!context->global_object()->IsUndefined(context->GetIsolate()));
36 // Reset math random cache to get fresh random numbers.
37 context->set_math_random_index(Smi::kZero);
38 context->set_math_random_cache(isolate_->heap()->undefined_value());
36 } 39 }
37 } 40 }
38 VisitPointer(o); 41 VisitPointer(o);
39 SerializeDeferredObjects(); 42 SerializeDeferredObjects();
40 Pad(); 43 Pad();
41 } 44 }
42 45
43 void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, 46 void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
44 WhereToPoint where_to_point, int skip) { 47 WhereToPoint where_to_point, int skip) {
45 if (obj->IsMap()) { 48 if (obj->IsMap()) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // would cause dupes. 108 // would cause dupes.
106 DCHECK(!o->IsScript()); 109 DCHECK(!o->IsScript());
107 return o->IsName() || o->IsSharedFunctionInfo() || o->IsHeapNumber() || 110 return o->IsName() || o->IsSharedFunctionInfo() || o->IsHeapNumber() ||
108 o->IsCode() || o->IsScopeInfo() || o->IsAccessorInfo() || 111 o->IsCode() || o->IsScopeInfo() || o->IsAccessorInfo() ||
109 o->map() == 112 o->map() ==
110 startup_serializer_->isolate()->heap()->fixed_cow_array_map(); 113 startup_serializer_->isolate()->heap()->fixed_cow_array_map();
111 } 114 }
112 115
113 } // namespace internal 116 } // namespace internal
114 } // namespace v8 117 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | src/v8.gyp » ('j') | test/mjsunit/debug-script.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698