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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 1369293003: Wrap JSFunction bindings in a helper object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Better wrapping. Created 5 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
OLDNEW
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/debug/debug-evaluate.h" 9 #include "src/debug/debug-evaluate.h"
10 #include "src/debug/debug-frames.h" 10 #include "src/debug/debug-frames.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, 150 MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
151 Handle<Object> object) { 151 Handle<Object> object) {
152 Factory* factory = isolate->factory(); 152 Factory* factory = isolate->factory();
153 if (object->IsJSFunction()) { 153 if (object->IsJSFunction()) {
154 Handle<JSFunction> function = Handle<JSFunction>::cast(object); 154 Handle<JSFunction> function = Handle<JSFunction>::cast(object);
155 if (function->shared()->bound()) { 155 if (function->shared()->bound()) {
156 RUNTIME_ASSERT_HANDLIFIED(function->function_bindings()->IsFixedArray(), 156 RUNTIME_ASSERT_HANDLIFIED(function->function_bindings()->IsFixedArray(),
157 JSArray); 157 JSArray);
158 158
159 Handle<FixedArray> bindings(function->function_bindings()); 159 Handle<BindingsArray> bindings(function->function_bindings());
160 160
161 Handle<FixedArray> result = factory->NewFixedArray(2 * 3); 161 Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
162 Handle<String> target = 162 Handle<String> target =
163 factory->NewStringFromAsciiChecked("[[TargetFunction]]"); 163 factory->NewStringFromAsciiChecked("[[TargetFunction]]");
164 result->set(0, *target); 164 result->set(0, *target);
165 result->set(1, bindings->get(JSFunction::kBoundFunctionIndex)); 165 result->set(1, bindings->bound_function());
166 166
167 Handle<String> bound_this = 167 Handle<String> bound_this =
168 factory->NewStringFromAsciiChecked("[[BoundThis]]"); 168 factory->NewStringFromAsciiChecked("[[BoundThis]]");
169 result->set(2, *bound_this); 169 result->set(2, *bound_this);
170 result->set(3, bindings->get(JSFunction::kBoundThisIndex)); 170 result->set(3, bindings->bound_this());
171 171
172 Handle<FixedArray> arguments = factory->NewFixedArray(
173 bindings->length() - JSFunction::kBoundArgumentsStartIndex);
174 bindings->CopyTo(
175 JSFunction::kBoundArgumentsStartIndex, *arguments, 0,
176 bindings->length() - JSFunction::kBoundArgumentsStartIndex);
177 Handle<String> bound_args = 172 Handle<String> bound_args =
178 factory->NewStringFromAsciiChecked("[[BoundArgs]]"); 173 factory->NewStringFromAsciiChecked("[[BoundArgs]]");
179 result->set(4, *bound_args); 174 result->set(4, *bound_args);
180 Handle<JSArray> arguments_array = 175 Handle<JSArray> arguments_array =
181 factory->NewJSArrayWithElements(arguments); 176 BindingsArray::CreateBoundArguments(bindings);
182 result->set(5, *arguments_array); 177 result->set(5, *arguments_array);
183 return factory->NewJSArrayWithElements(result); 178 return factory->NewJSArrayWithElements(result);
184 } 179 }
185 } else if (object->IsJSMapIterator()) { 180 } else if (object->IsJSMapIterator()) {
186 Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object); 181 Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object);
187 return GetIteratorInternalProperties(isolate, iterator); 182 return GetIteratorInternalProperties(isolate, iterator);
188 } else if (object->IsJSSetIterator()) { 183 } else if (object->IsJSSetIterator()) {
189 Handle<JSSetIterator> iterator = Handle<JSSetIterator>::cast(object); 184 Handle<JSSetIterator> iterator = Handle<JSSetIterator>::cast(object);
190 return GetIteratorInternalProperties(isolate, iterator); 185 return GetIteratorInternalProperties(isolate, iterator);
191 } else if (object->IsJSGeneratorObject()) { 186 } else if (object->IsJSGeneratorObject()) {
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 return *isolate->factory()->undefined_value(); 1714 return *isolate->factory()->undefined_value();
1720 } 1715 }
1721 1716
1722 1717
1723 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1718 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1724 UNIMPLEMENTED(); 1719 UNIMPLEMENTED();
1725 return NULL; 1720 return NULL;
1726 } 1721 }
1727 } // namespace internal 1722 } // namespace internal
1728 } // namespace v8 1723 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698