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

Side by Side Diff: src/factory.cc

Issue 659513003: Use WeakCell to handle the script wrapper cache (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove special handling during serialization 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 | « no previous file | src/objects.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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 830
831 831
832 Handle<Script> Factory::NewScript(Handle<String> source) { 832 Handle<Script> Factory::NewScript(Handle<String> source) {
833 // Generate id for this script. 833 // Generate id for this script.
834 Heap* heap = isolate()->heap(); 834 Heap* heap = isolate()->heap();
835 int id = heap->last_script_id()->value() + 1; 835 int id = heap->last_script_id()->value() + 1;
836 if (!Smi::IsValid(id) || id < 0) id = 1; 836 if (!Smi::IsValid(id) || id < 0) id = 1;
837 heap->set_last_script_id(Smi::FromInt(id)); 837 heap->set_last_script_id(Smi::FromInt(id));
838 838
839 // Create and initialize script object. 839 // Create and initialize script object.
840 Handle<Foreign> wrapper = NewForeign(0, TENURED);
841 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); 840 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
842 script->set_source(*source); 841 script->set_source(*source);
843 script->set_name(heap->undefined_value()); 842 script->set_name(heap->undefined_value());
844 script->set_id(Smi::FromInt(id)); 843 script->set_id(Smi::FromInt(id));
845 script->set_line_offset(Smi::FromInt(0)); 844 script->set_line_offset(Smi::FromInt(0));
846 script->set_column_offset(Smi::FromInt(0)); 845 script->set_column_offset(Smi::FromInt(0));
847 script->set_context_data(heap->undefined_value()); 846 script->set_context_data(heap->undefined_value());
848 script->set_type(Smi::FromInt(Script::TYPE_NORMAL)); 847 script->set_type(Smi::FromInt(Script::TYPE_NORMAL));
849 script->set_wrapper(*wrapper); 848 script->set_wrapper(heap->undefined_value());
850 script->set_line_ends(heap->undefined_value()); 849 script->set_line_ends(heap->undefined_value());
851 script->set_eval_from_shared(heap->undefined_value()); 850 script->set_eval_from_shared(heap->undefined_value());
852 script->set_eval_from_instructions_offset(Smi::FromInt(0)); 851 script->set_eval_from_instructions_offset(Smi::FromInt(0));
853 script->set_flags(Smi::FromInt(0)); 852 script->set_flags(Smi::FromInt(0));
854 853
855 return script; 854 return script;
856 } 855 }
857 856
858 857
859 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) { 858 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) {
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 return Handle<Object>::null(); 2457 return Handle<Object>::null();
2459 } 2458 }
2460 2459
2461 2460
2462 Handle<Object> Factory::ToBoolean(bool value) { 2461 Handle<Object> Factory::ToBoolean(bool value) {
2463 return value ? true_value() : false_value(); 2462 return value ? true_value() : false_value();
2464 } 2463 }
2465 2464
2466 2465
2467 } } // namespace v8::internal 2466 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698