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

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

Issue 1270393002: [strong] Refactor out separate strong runtime call for class objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback Created 5 years, 4 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 | « src/runtime/runtime.h ('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 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) { 256 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) {
257 HandleScope scope(isolate); 257 HandleScope scope(isolate);
258 DCHECK(args.length() == 2); 258 DCHECK(args.length() == 2);
259 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0); 259 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0);
260 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1); 260 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1);
261 261
262 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties"); 262 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties");
263 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties"); 263 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties");
264 264
265 if (constructor->map()->is_strong()) {
266 DCHECK(prototype->map()->is_strong());
267 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype));
268 Handle<Object> result;
269 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
270 JSObject::Freeze(constructor));
271 return *result;
272 }
265 return *constructor; 273 return *constructor;
266 } 274 }
267 275
268 276
269 RUNTIME_FUNCTION(Runtime_FinalizeClassDefinitionStrong) {
270 HandleScope scope(isolate);
271 DCHECK(args.length() == 2);
272 CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0);
273 CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1);
274
275 JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties");
276 JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties");
277
278 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype));
279 Handle<Object> result;
280 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
281 JSObject::Freeze(constructor));
282 return *result;
283 }
284
285
286 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { 277 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) {
287 HandleScope shs(isolate); 278 HandleScope shs(isolate);
288 DCHECK(args.length() == 1); 279 DCHECK(args.length() == 1);
289 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); 280 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
290 281
291 Handle<Object> script; 282 Handle<Object> script;
292 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 283 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
293 isolate, script, 284 isolate, script,
294 Object::GetProperty(fun, isolate->factory()->class_script_symbol())); 285 Object::GetProperty(fun, isolate->factory()->class_script_symbol()));
295 if (!script->IsScript()) { 286 if (!script->IsScript()) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 Handle<Object> result; 581 Handle<Object> result;
591 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 582 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
592 isolate, result, 583 isolate, result,
593 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), 584 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(),
594 arraysize(argv), argv)); 585 arraysize(argv), argv));
595 586
596 return *result; 587 return *result;
597 } 588 }
598 } // namespace internal 589 } // namespace internal
599 } // namespace v8 590 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698