OLD | NEW |
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 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 // Compute the frame holding the arguments. | 3126 // Compute the frame holding the arguments. |
3127 JavaScriptFrameIterator it; | 3127 JavaScriptFrameIterator it; |
3128 it.AdvanceToArgumentsFrame(); | 3128 it.AdvanceToArgumentsFrame(); |
3129 JavaScriptFrame* frame = it.frame(); | 3129 JavaScriptFrame* frame = it.frame(); |
3130 | 3130 |
3131 const int length = frame->GetProvidedParametersCount(); | 3131 const int length = frame->GetProvidedParametersCount(); |
3132 Object* result = Heap::AllocateArgumentsObject(callee, length); | 3132 Object* result = Heap::AllocateArgumentsObject(callee, length); |
3133 if (result->IsFailure()) return result; | 3133 if (result->IsFailure()) return result; |
3134 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements()); | 3134 FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements()); |
3135 ASSERT(array->length() == length); | 3135 ASSERT(array->length() == length); |
| 3136 FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); |
3136 for (int i = 0; i < length; i++) { | 3137 for (int i = 0; i < length; i++) { |
3137 array->set(i, frame->GetParameter(i)); | 3138 array->set(i, frame->GetParameter(i), mode); |
3138 } | 3139 } |
3139 return result; | 3140 return result; |
3140 } | 3141 } |
3141 | 3142 |
3142 | 3143 |
3143 static Object* Runtime_NewArgumentsFast(Arguments args) { | 3144 static Object* Runtime_NewArgumentsFast(Arguments args) { |
3144 NoHandleAllocation ha; | 3145 NoHandleAllocation ha; |
3145 ASSERT(args.length() == 3); | 3146 ASSERT(args.length() == 3); |
3146 | 3147 |
3147 JSFunction* callee = JSFunction::cast(args[0]); | 3148 JSFunction* callee = JSFunction::cast(args[0]); |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4858 NULL); | 4859 NULL); |
4859 if (index != -1) { | 4860 if (index != -1) { |
4860 return Handle<Object>(function_context->get(index)); | 4861 return Handle<Object>(function_context->get(index)); |
4861 } | 4862 } |
4862 } | 4863 } |
4863 | 4864 |
4864 const int length = frame->GetProvidedParametersCount(); | 4865 const int length = frame->GetProvidedParametersCount(); |
4865 Handle<Object> arguments = Factory::NewArgumentsObject(function, length); | 4866 Handle<Object> arguments = Factory::NewArgumentsObject(function, length); |
4866 FixedArray* array = FixedArray::cast(JSObject::cast(*arguments)->elements()); | 4867 FixedArray* array = FixedArray::cast(JSObject::cast(*arguments)->elements()); |
4867 ASSERT(array->length() == length); | 4868 ASSERT(array->length() == length); |
| 4869 FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); |
4868 for (int i = 0; i < length; i++) { | 4870 for (int i = 0; i < length; i++) { |
4869 array->set(i, frame->GetParameter(i)); | 4871 array->set(i, frame->GetParameter(i), mode); |
4870 } | 4872 } |
4871 return arguments; | 4873 return arguments; |
4872 } | 4874 } |
4873 | 4875 |
4874 | 4876 |
4875 // Evaluate a piece of JavaScript in the context of a stack frame for | 4877 // Evaluate a piece of JavaScript in the context of a stack frame for |
4876 // debugging. This is acomplished by creating a new context which in its | 4878 // debugging. This is acomplished by creating a new context which in its |
4877 // extension part has all the parameters and locals of the function on the | 4879 // extension part has all the parameters and locals of the function on the |
4878 // stack frame. A function which calls eval with the code to evaluate is then | 4880 // stack frame. A function which calls eval with the code to evaluate is then |
4879 // compiled in this context and called in this context. As this context | 4881 // compiled in this context and called in this context. As this context |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5472 | 5474 |
5473 void Runtime::PerformGC(Object* result) { | 5475 void Runtime::PerformGC(Object* result) { |
5474 Failure* failure = Failure::cast(result); | 5476 Failure* failure = Failure::cast(result); |
5475 // Try to do a garbage collection; ignore it if it fails. The C | 5477 // Try to do a garbage collection; ignore it if it fails. The C |
5476 // entry stub will throw an out-of-memory exception in that case. | 5478 // entry stub will throw an out-of-memory exception in that case. |
5477 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 5479 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
5478 } | 5480 } |
5479 | 5481 |
5480 | 5482 |
5481 } } // namespace v8::internal | 5483 } } // namespace v8::internal |
OLD | NEW |