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

Side by Side Diff: src/runtime.cc

Issue 16337005: Deprecate FACTORY helper macro. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/scopeinfo.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 2809
2810 int length() { 2810 int length() {
2811 return length_; 2811 return length_;
2812 } 2812 }
2813 2813
2814 int capacity() { 2814 int capacity() {
2815 return array_->length(); 2815 return array_->length();
2816 } 2816 }
2817 2817
2818 Handle<JSArray> ToJSArray(Handle<JSArray> target_array) { 2818 Handle<JSArray> ToJSArray(Handle<JSArray> target_array) {
2819 FACTORY->SetContent(target_array, array_); 2819 Factory* factory = target_array->GetIsolate()->factory();
2820 factory->SetContent(target_array, array_);
2820 target_array->set_length(Smi::FromInt(length_)); 2821 target_array->set_length(Smi::FromInt(length_));
2821 return target_array; 2822 return target_array;
2822 } 2823 }
2823 2824
2824 2825
2825 private: 2826 private:
2826 Handle<FixedArray> array_; 2827 Handle<FixedArray> array_;
2827 int length_; 2828 int length_;
2828 bool has_non_smi_elements_; 2829 bool has_non_smi_elements_;
2829 }; 2830 };
(...skipping 4935 matching lines...) Expand 10 before | Expand all | Expand 10 after
7765 debug->HandleStepIn(function, Handle<Object>::null(), 0, true); 7766 debug->HandleStepIn(function, Handle<Object>::null(), 0, true);
7766 } 7767 }
7767 #endif 7768 #endif
7768 7769
7769 if (function->has_initial_map()) { 7770 if (function->has_initial_map()) {
7770 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { 7771 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) {
7771 // The 'Function' function ignores the receiver object when 7772 // The 'Function' function ignores the receiver object when
7772 // called using 'new' and creates a new JSFunction object that 7773 // called using 'new' and creates a new JSFunction object that
7773 // is returned. The receiver object is only used for error 7774 // is returned. The receiver object is only used for error
7774 // reporting if an error occurs when constructing the new 7775 // reporting if an error occurs when constructing the new
7775 // JSFunction. FACTORY->NewJSObject() should not be used to 7776 // JSFunction. Factory::NewJSObject() should not be used to
7776 // allocate JSFunctions since it does not properly initialize 7777 // allocate JSFunctions since it does not properly initialize
7777 // the shared part of the function. Since the receiver is 7778 // the shared part of the function. Since the receiver is
7778 // ignored anyway, we use the global object as the receiver 7779 // ignored anyway, we use the global object as the receiver
7779 // instead of a new JSFunction object. This way, errors are 7780 // instead of a new JSFunction object. This way, errors are
7780 // reported the same way whether or not 'Function' is called 7781 // reported the same way whether or not 'Function' is called
7781 // using 'new'. 7782 // using 'new'.
7782 return isolate->context()->global_object(); 7783 return isolate->context()->global_object();
7783 } 7784 }
7784 } 7785 }
7785 7786
(...skipping 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after
12997 // heap traversal to find the function generated for the source position 12998 // heap traversal to find the function generated for the source position
12998 // for the requested break point. For lazily compiled functions several heap 12999 // for the requested break point. For lazily compiled functions several heap
12999 // traversals might be required rendering this operation as a rather slow 13000 // traversals might be required rendering this operation as a rather slow
13000 // operation. However for setting break points which is normally done through 13001 // operation. However for setting break points which is normally done through
13001 // some kind of user interaction the performance is not crucial. 13002 // some kind of user interaction the performance is not crucial.
13002 static Handle<Object> Runtime_GetScriptFromScriptName( 13003 static Handle<Object> Runtime_GetScriptFromScriptName(
13003 Handle<String> script_name) { 13004 Handle<String> script_name) {
13004 // Scan the heap for Script objects to find the script with the requested 13005 // Scan the heap for Script objects to find the script with the requested
13005 // script data. 13006 // script data.
13006 Handle<Script> script; 13007 Handle<Script> script;
13008 Factory* factory = script_name->GetIsolate()->factory();
13007 Heap* heap = script_name->GetHeap(); 13009 Heap* heap = script_name->GetHeap();
13008 heap->EnsureHeapIsIterable(); 13010 heap->EnsureHeapIsIterable();
13009 AssertNoAllocation no_allocation_during_heap_iteration; 13011 AssertNoAllocation no_allocation_during_heap_iteration;
13010 HeapIterator iterator(heap); 13012 HeapIterator iterator(heap);
13011 HeapObject* obj = NULL; 13013 HeapObject* obj = NULL;
13012 while (script.is_null() && ((obj = iterator.next()) != NULL)) { 13014 while (script.is_null() && ((obj = iterator.next()) != NULL)) {
13013 // If a script is found check if it has the script data requested. 13015 // If a script is found check if it has the script data requested.
13014 if (obj->IsScript()) { 13016 if (obj->IsScript()) {
13015 if (Script::cast(obj)->name()->IsString()) { 13017 if (Script::cast(obj)->name()->IsString()) {
13016 if (String::cast(Script::cast(obj)->name())->Equals(*script_name)) { 13018 if (String::cast(Script::cast(obj)->name())->Equals(*script_name)) {
13017 script = Handle<Script>(Script::cast(obj)); 13019 script = Handle<Script>(Script::cast(obj));
13018 } 13020 }
13019 } 13021 }
13020 } 13022 }
13021 } 13023 }
13022 13024
13023 // If no script with the requested script data is found return undefined. 13025 // If no script with the requested script data is found return undefined.
13024 if (script.is_null()) return FACTORY->undefined_value(); 13026 if (script.is_null()) return factory->undefined_value();
13025 13027
13026 // Return the script found. 13028 // Return the script found.
13027 return GetScriptWrapper(script); 13029 return GetScriptWrapper(script);
13028 } 13030 }
13029 13031
13030 13032
13031 // Get the script object from script data. NOTE: Regarding performance 13033 // Get the script object from script data. NOTE: Regarding performance
13032 // see the NOTE for GetScriptFromScriptData. 13034 // see the NOTE for GetScriptFromScriptData.
13033 // args[0]: script data for the script to find the source for 13035 // args[0]: script data for the script to find the source for
13034 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScript) { 13036 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScript) {
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
13522 // Handle last resort GC and make sure to allow future allocations 13524 // Handle last resort GC and make sure to allow future allocations
13523 // to grow the heap without causing GCs (if possible). 13525 // to grow the heap without causing GCs (if possible).
13524 isolate->counters()->gc_last_resort_from_js()->Increment(); 13526 isolate->counters()->gc_last_resort_from_js()->Increment();
13525 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13527 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13526 "Runtime::PerformGC"); 13528 "Runtime::PerformGC");
13527 } 13529 }
13528 } 13530 }
13529 13531
13530 13532
13531 } } // namespace v8::internal 13533 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698