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

Side by Side Diff: src/runtime.cc

Issue 8098: - Added conditional write barrier to object accessors.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 // Compute the frame holding the arguments. 3129 // Compute the frame holding the arguments.
3130 JavaScriptFrameIterator it; 3130 JavaScriptFrameIterator it;
3131 it.AdvanceToArgumentsFrame(); 3131 it.AdvanceToArgumentsFrame();
3132 JavaScriptFrame* frame = it.frame(); 3132 JavaScriptFrame* frame = it.frame();
3133 3133
3134 const int length = frame->GetProvidedParametersCount(); 3134 const int length = frame->GetProvidedParametersCount();
3135 Object* result = Heap::AllocateArgumentsObject(callee, length); 3135 Object* result = Heap::AllocateArgumentsObject(callee, length);
3136 if (result->IsFailure()) return result; 3136 if (result->IsFailure()) return result;
3137 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements()); 3137 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements());
3138 ASSERT(array->length() == length); 3138 ASSERT(array->length() == length);
3139 FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); 3139 WriteBarrierMode mode = array->GetWriteBarrierMode();
3140 for (int i = 0; i < length; i++) { 3140 for (int i = 0; i < length; i++) {
3141 array->set(i, frame->GetParameter(i), mode); 3141 array->set(i, frame->GetParameter(i), mode);
3142 } 3142 }
3143 return result; 3143 return result;
3144 } 3144 }
3145 3145
3146 3146
3147 static Object* Runtime_NewArgumentsFast(Arguments args) { 3147 static Object* Runtime_NewArgumentsFast(Arguments args) {
3148 NoHandleAllocation ha; 3148 NoHandleAllocation ha;
3149 ASSERT(args.length() == 3); 3149 ASSERT(args.length() == 3);
3150 3150
3151 JSFunction* callee = JSFunction::cast(args[0]); 3151 JSFunction* callee = JSFunction::cast(args[0]);
3152 Object** parameters = reinterpret_cast<Object**>(args[1]); 3152 Object** parameters = reinterpret_cast<Object**>(args[1]);
3153 const int length = Smi::cast(args[2])->value(); 3153 const int length = Smi::cast(args[2])->value();
3154 3154
3155 Object* result = Heap::AllocateArgumentsObject(callee, length); 3155 Object* result = Heap::AllocateArgumentsObject(callee, length);
3156 if (result->IsFailure()) return result; 3156 if (result->IsFailure()) return result;
3157 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements()); 3157 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements());
3158 ASSERT(array->length() == length); 3158 ASSERT(array->length() == length);
3159 FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); 3159 WriteBarrierMode mode = array->GetWriteBarrierMode();
3160 for (int i = 0; i < length; i++) { 3160 for (int i = 0; i < length; i++) {
3161 array->set(i, *--parameters, mode); 3161 array->set(i, *--parameters, mode);
3162 } 3162 }
3163 return result; 3163 return result;
3164 } 3164 }
3165 3165
3166 3166
3167 static Object* Runtime_NewClosure(Arguments args) { 3167 static Object* Runtime_NewClosure(Arguments args) {
3168 HandleScope scope; 3168 HandleScope scope;
3169 ASSERT(args.length() == 2); 3169 ASSERT(args.length() == 2);
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
4012 uint32_t index; 4012 uint32_t index;
4013 if (!Array::IndexFromObject(key, &index) || index >= length) { 4013 if (!Array::IndexFromObject(key, &index) || index >= length) {
4014 // Zap invalid keys. 4014 // Zap invalid keys.
4015 keys->set_undefined(i); 4015 keys->set_undefined(i);
4016 } 4016 }
4017 } 4017 }
4018 return *Factory::NewJSArrayWithElements(keys); 4018 return *Factory::NewJSArrayWithElements(keys);
4019 } else { 4019 } else {
4020 Handle<FixedArray> single_interval = Factory::NewFixedArray(2); 4020 Handle<FixedArray> single_interval = Factory::NewFixedArray(2);
4021 // -1 means start of array. 4021 // -1 means start of array.
4022 single_interval->set(0, Smi::FromInt(-1)); 4022 single_interval->set(0,
4023 Smi::FromInt(-1),
4024 SKIP_WRITE_BARRIER);
4023 Handle<Object> length_object = 4025 Handle<Object> length_object =
4024 Factory::NewNumber(static_cast<double>(length)); 4026 Factory::NewNumber(static_cast<double>(length));
4025 single_interval->set(1, *length_object); 4027 single_interval->set(1, *length_object);
4026 return *Factory::NewJSArrayWithElements(single_interval); 4028 return *Factory::NewJSArrayWithElements(single_interval);
4027 } 4029 }
4028 } 4030 }
4029 4031
4030 4032
4031 // DefineAccessor takes an optional final argument which is the 4033 // DefineAccessor takes an optional final argument which is the
4032 // property attributes (eg, DONT_ENUM, DONT_DELETE). IMPORTANT: due 4034 // property attributes (eg, DONT_ENUM, DONT_DELETE). IMPORTANT: due
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
4862 NULL); 4864 NULL);
4863 if (index != -1) { 4865 if (index != -1) {
4864 return Handle<Object>(function_context->get(index)); 4866 return Handle<Object>(function_context->get(index));
4865 } 4867 }
4866 } 4868 }
4867 4869
4868 const int length = frame->GetProvidedParametersCount(); 4870 const int length = frame->GetProvidedParametersCount();
4869 Handle<Object> arguments = Factory::NewArgumentsObject(function, length); 4871 Handle<Object> arguments = Factory::NewArgumentsObject(function, length);
4870 FixedArray* array = FixedArray::cast(JSObject::cast(*arguments)->elements()); 4872 FixedArray* array = FixedArray::cast(JSObject::cast(*arguments)->elements());
4871 ASSERT(array->length() == length); 4873 ASSERT(array->length() == length);
4872 FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); 4874 WriteBarrierMode mode = array->GetWriteBarrierMode();
4873 for (int i = 0; i < length; i++) { 4875 for (int i = 0; i < length; i++) {
4874 array->set(i, frame->GetParameter(i), mode); 4876 array->set(i, frame->GetParameter(i), mode);
4875 } 4877 }
4876 return arguments; 4878 return arguments;
4877 } 4879 }
4878 4880
4879 4881
4880 // Evaluate a piece of JavaScript in the context of a stack frame for 4882 // Evaluate a piece of JavaScript in the context of a stack frame for
4881 // debugging. This is acomplished by creating a new context which in its 4883 // debugging. This is acomplished by creating a new context which in its
4882 // extension part has all the parameters and locals of the function on the 4884 // extension part has all the parameters and locals of the function on the
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
5477 5479
5478 void Runtime::PerformGC(Object* result) { 5480 void Runtime::PerformGC(Object* result) {
5479 Failure* failure = Failure::cast(result); 5481 Failure* failure = Failure::cast(result);
5480 // Try to do a garbage collection; ignore it if it fails. The C 5482 // Try to do a garbage collection; ignore it if it fails. The C
5481 // entry stub will throw an out-of-memory exception in that case. 5483 // entry stub will throw an out-of-memory exception in that case.
5482 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); 5484 Heap::CollectGarbage(failure->requested(), failure->allocation_space());
5483 } 5485 }
5484 5486
5485 5487
5486 } } // namespace v8::internal 5488 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698