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

Side by Side Diff: src/runtime.cc

Issue 8816020: More removal of write barriers and a rename to a less scary name. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | src/spaces.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 7979 matching lines...) Expand 10 before | Expand all | Expand 10 after
7990 // Allocate the elements if needed. 7990 // Allocate the elements if needed.
7991 if (length > 0) { 7991 if (length > 0) {
7992 // Allocate the fixed array. 7992 // Allocate the fixed array.
7993 Object* obj; 7993 Object* obj;
7994 { MaybeObject* maybe_obj = isolate->heap()->AllocateRawFixedArray(length); 7994 { MaybeObject* maybe_obj = isolate->heap()->AllocateRawFixedArray(length);
7995 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 7995 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
7996 } 7996 }
7997 7997
7998 AssertNoAllocation no_gc; 7998 AssertNoAllocation no_gc;
7999 FixedArray* array = reinterpret_cast<FixedArray*>(obj); 7999 FixedArray* array = reinterpret_cast<FixedArray*>(obj);
8000 array->set_map(isolate->heap()->fixed_array_map()); 8000 array->set_map_no_wb(isolate->heap()->fixed_array_map());
8001 array->set_length(length); 8001 array->set_length(length);
8002 8002
8003 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc); 8003 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
8004 for (int i = 0; i < length; i++) { 8004 for (int i = 0; i < length; i++) {
8005 array->set(i, *--parameters, mode); 8005 array->set(i, *--parameters, mode);
8006 } 8006 }
8007 JSObject::cast(result)->set_elements(FixedArray::cast(obj)); 8007 JSObject::cast(result)->set_elements(FixedArray::cast(obj));
8008 } 8008 }
8009 return result; 8009 return result;
8010 } 8010 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
8110 int array_size = JSFunction::kBoundArgumentsStartIndex + argc; 8110 int array_size = JSFunction::kBoundArgumentsStartIndex + argc;
8111 new_bindings = isolate->factory()->NewFixedArray(array_size); 8111 new_bindings = isolate->factory()->NewFixedArray(array_size);
8112 new_bindings->set(JSFunction::kBoundFunctionIndex, *bindee); 8112 new_bindings->set(JSFunction::kBoundFunctionIndex, *bindee);
8113 new_bindings->set(JSFunction::kBoundThisIndex, args[2]); 8113 new_bindings->set(JSFunction::kBoundThisIndex, args[2]);
8114 i = 2; 8114 i = 2;
8115 } 8115 }
8116 // Copy arguments, skipping the first which is "this_arg". 8116 // Copy arguments, skipping the first which is "this_arg".
8117 for (int j = 0; j < argc; j++, i++) { 8117 for (int j = 0; j < argc; j++, i++) {
8118 new_bindings->set(i, *arguments[j + 1]); 8118 new_bindings->set(i, *arguments[j + 1]);
8119 } 8119 }
8120 new_bindings->set_map(isolate->heap()->fixed_cow_array_map()); 8120 new_bindings->set_map_no_wb(isolate->heap()->fixed_cow_array_map());
8121 bound_function->set_function_bindings(*new_bindings); 8121 bound_function->set_function_bindings(*new_bindings);
8122 8122
8123 // Update length. 8123 // Update length.
8124 Handle<String> length_symbol = isolate->factory()->length_symbol(); 8124 Handle<String> length_symbol = isolate->factory()->length_symbol();
8125 Handle<Object> new_length(args.at<Object>(3)); 8125 Handle<Object> new_length(args.at<Object>(3));
8126 PropertyAttributes attr = 8126 PropertyAttributes attr =
8127 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY); 8127 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY);
8128 ForceSetProperty(bound_function, length_symbol, new_length, attr); 8128 ForceSetProperty(bound_function, length_symbol, new_length, attr);
8129 return *bound_function; 8129 return *bound_function;
8130 } 8130 }
(...skipping 5437 matching lines...) Expand 10 before | Expand all | Expand 10 after
13568 } else { 13568 } else {
13569 // Handle last resort GC and make sure to allow future allocations 13569 // Handle last resort GC and make sure to allow future allocations
13570 // to grow the heap without causing GCs (if possible). 13570 // to grow the heap without causing GCs (if possible).
13571 isolate->counters()->gc_last_resort_from_js()->Increment(); 13571 isolate->counters()->gc_last_resort_from_js()->Increment();
13572 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13572 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13573 } 13573 }
13574 } 13574 }
13575 13575
13576 13576
13577 } } // namespace v8::internal 13577 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698