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

Unified Diff: src/objects.cc

Issue 1369293003: Wrap JSFunction bindings in a helper object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index b6c40d67fe8a64c13d4f7b44779e47281956a306..d23a6c1ea4e221117151a6020182372742f270ae 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8795,6 +8795,47 @@ Handle<LiteralsArray> LiteralsArray::New(Isolate* isolate,
}
+// static
+Handle<BindingsArray> BindingsArray::New(Isolate* isolate,
+ Handle<TypeFeedbackVector> vector,
+ Handle<JSReceiver> bound_function,
+ Handle<Object> bound_this,
+ int number_of_bindings) {
+ Handle<FixedArray> bindings = isolate->factory()->NewFixedArray(
+ number_of_bindings + kFirstBindingIndex);
+ Handle<BindingsArray> casted_bindings = Handle<BindingsArray>::cast(bindings);
+ casted_bindings->set_feedback_vector(*vector);
+ casted_bindings->set_bound_function(*bound_function);
+ casted_bindings->set_bound_this(*bound_this);
+ return casted_bindings;
+}
+
+
+// static
+Handle<JSArray> BindingsArray::CreateBoundArguments(
+ Handle<BindingsArray> bindings) {
+ int bound_argument_count = bindings->bindings_count();
+ Factory* factory = bindings->GetIsolate()->factory();
+ Handle<FixedArray> arguments = factory->NewFixedArray(bound_argument_count);
+ bindings->CopyTo(kFirstBindingIndex, *arguments, 0, bound_argument_count);
+ return factory->NewJSArrayWithElements(arguments);
+}
+
+
+// static
+Handle<JSArray> BindingsArray::CreateRuntimeBindings(
+ Handle<BindingsArray> bindings) {
+ Factory* factory = bindings->GetIsolate()->factory();
+ // A runtime bindings array consists of
+ // [bound function, bound this, [arg0, arg1, ...]].
+ Handle<FixedArray> runtime_bindings =
+ factory->NewFixedArray(2 + bindings->bindings_count());
+ bindings->CopyTo(kBoundFunctionIndex, *runtime_bindings, 0,
+ 2 + bindings->bindings_count());
+ return factory->NewJSArrayWithElements(runtime_bindings);
+}
+
+
int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
CatchPrediction* prediction_out) {
int innermost_handler = -1, innermost_start = -1;
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698