OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 // Compute the frame holding the arguments. | 1056 // Compute the frame holding the arguments. |
1057 JavaScriptFrameIterator it(isolate); | 1057 JavaScriptFrameIterator it(isolate); |
1058 it.AdvanceToArgumentsFrame(); | 1058 it.AdvanceToArgumentsFrame(); |
1059 JavaScriptFrame* frame = it.frame(); | 1059 JavaScriptFrame* frame = it.frame(); |
1060 | 1060 |
1061 // Get the actual number of provided arguments. | 1061 // Get the actual number of provided arguments. |
1062 const uint32_t n = frame->ComputeParametersCount(); | 1062 const uint32_t n = frame->ComputeParametersCount(); |
1063 | 1063 |
1064 // Try to convert the key to an index. If successful and within | 1064 // Try to convert the key to an index. If successful and within |
1065 // index return the the argument from the frame. | 1065 // index return the the argument from the frame. |
1066 uint32_t index; | 1066 uint32_t index = 0; |
1067 if (raw_key->ToArrayIndex(&index) && index < n) { | 1067 if (raw_key->ToArrayIndex(&index) && index < n) { |
1068 return frame->GetParameter(index); | 1068 return frame->GetParameter(index); |
1069 } | 1069 } |
1070 | 1070 |
1071 HandleScope scope(isolate); | 1071 HandleScope scope(isolate); |
1072 if (raw_key->IsSymbol()) { | 1072 if (raw_key->IsSymbol()) { |
1073 Handle<Symbol> symbol = Handle<Symbol>::cast(raw_key); | 1073 Handle<Symbol> symbol = Handle<Symbol>::cast(raw_key); |
1074 if (Name::Equals(symbol, isolate->factory()->iterator_symbol())) { | 1074 if (Name::Equals(symbol, isolate->factory()->iterator_symbol())) { |
1075 return isolate->native_context()->array_values_iterator(); | 1075 return isolate->native_context()->array_values_iterator(); |
1076 } | 1076 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 return Smi::FromInt(frame->GetArgumentsLength()); | 1133 return Smi::FromInt(frame->GetArgumentsLength()); |
1134 } | 1134 } |
1135 | 1135 |
1136 | 1136 |
1137 RUNTIME_FUNCTION(Runtime_Arguments) { | 1137 RUNTIME_FUNCTION(Runtime_Arguments) { |
1138 SealHandleScope shs(isolate); | 1138 SealHandleScope shs(isolate); |
1139 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1139 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1140 } | 1140 } |
1141 } // namespace internal | 1141 } // namespace internal |
1142 } // namespace v8 | 1142 } // namespace v8 |
OLD | NEW |