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

Side by Side Diff: src/api-natives.cc

Issue 1137693003: Added constructor call on object in InstantiateObject method (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Wrapped Execution::Call in RETURN_ON_EXCEPTION Created 5 years, 6 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/api-natives.h" 5 #include "src/api-natives.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/isolate.h" 8 #include "src/isolate.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (constructor->IsUndefined()) { 198 if (constructor->IsUndefined()) {
199 cons = isolate->object_function(); 199 cons = isolate->object_function();
200 } else { 200 } else {
201 auto cons_templ = Handle<FunctionTemplateInfo>::cast(constructor); 201 auto cons_templ = Handle<FunctionTemplateInfo>::cast(constructor);
202 ASSIGN_RETURN_ON_EXCEPTION( 202 ASSIGN_RETURN_ON_EXCEPTION(
203 isolate, cons, InstantiateFunction(isolate, cons_templ), JSFunction); 203 isolate, cons, InstantiateFunction(isolate, cons_templ), JSFunction);
204 } 204 }
205 auto object = isolate->factory()->NewJSObject(cons); 205 auto object = isolate->factory()->NewJSObject(cons);
206 ASSIGN_RETURN_ON_EXCEPTION( 206 ASSIGN_RETURN_ON_EXCEPTION(
207 isolate, result, ConfigureInstance(isolate, object, info), JSFunction); 207 isolate, result, ConfigureInstance(isolate, object, info), JSFunction);
208 if (!constructor->IsUndefined()) {
209 RETURN_ON_EXCEPTION(
210 isolate, Execution::Call(isolate, cons, result, 0, nullptr), JSObject);
211 }
208 // TODO(dcarney): is this necessary? 212 // TODO(dcarney): is this necessary?
209 JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject"); 213 JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject");
210 return scope.CloseAndEscape(result); 214 return scope.CloseAndEscape(result);
211 } 215 }
212 216
213 217
214 void CacheFunction(Isolate* isolate, Handle<Smi> serial_number, 218 void CacheFunction(Isolate* isolate, Handle<Smi> serial_number,
215 Handle<JSFunction> function) { 219 Handle<JSFunction> function) {
216 auto cache = isolate->function_cache(); 220 auto cache = isolate->function_cache();
217 auto new_cache = ObjectHashTable::Put(cache, serial_number, function); 221 auto new_cache = ObjectHashTable::Put(cache, serial_number, function);
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); 583 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)));
580 JSObject::SetAccessor(result, accessor).Assert(); 584 JSObject::SetAccessor(result, accessor).Assert();
581 } 585 }
582 586
583 DCHECK(result->shared()->IsApiFunction()); 587 DCHECK(result->shared()->IsApiFunction());
584 return result; 588 return result;
585 } 589 }
586 590
587 } // namespace internal 591 } // namespace internal
588 } // namespace v8 592 } // namespace v8
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698