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

Unified Diff: src/runtime.cc

Issue 2878057: Fix some bugs in Function.prototype.bind implementation. (Closed)
Patch Set: Created 10 years, 5 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 | « no previous file | src/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index a6924a0ff362250918b8af2b6b1b3eb77087faee..4063a0fc7d751aa86c4fd47ab46b2e1e9d05bcf9 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6757,17 +6757,23 @@ static Object* Runtime_NewObjectFromBound(Arguments args) {
CONVERT_ARG_CHECKED(JSFunction, function, 0);
CONVERT_ARG_CHECKED(JSArray, params, 1);
+ RUNTIME_ASSERT(params->HasFastElements());
FixedArray* fixed = FixedArray::cast(params->elements());
- bool exception = false;
- Object*** param_data = NewArray<Object**>(fixed->length());
- for (int i = 0; i < fixed->length(); i++) {
+ int fixed_length = Smi::cast(params->length())->value();
+ SmartPointer<Object**> param_data(NewArray<Object**>(fixed_length));
+ for (int i = 0; i < fixed_length; i++) {
Handle<Object> val = Handle<Object>(fixed->get(i));
param_data[i] = val.location();
}
+ bool exception = false;
Handle<Object> result = Execution::New(
- function, fixed->length(), param_data, &exception);
+ function, fixed_length, *param_data, &exception);
+ if (exception) {
+ return Failure::Exception();
+ }
+ ASSERT(!result.is_null());
return *result;
}
« no previous file with comments | « no previous file | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698