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

Side by Side Diff: src/runtime.cc

Issue 3031005: [Isolates] Avoid dereferencing Isolate::Current() to check oddball identities... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/prettyprinter.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 static Object* Runtime_CreateObjectLiteral(Arguments args) { 391 static Object* Runtime_CreateObjectLiteral(Arguments args) {
392 HandleScope scope; 392 HandleScope scope;
393 ASSERT(args.length() == 4); 393 ASSERT(args.length() == 4);
394 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 394 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
395 CONVERT_SMI_CHECKED(literals_index, args[1]); 395 CONVERT_SMI_CHECKED(literals_index, args[1]);
396 CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); 396 CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2);
397 CONVERT_SMI_CHECKED(fast_elements, args[3]); 397 CONVERT_SMI_CHECKED(fast_elements, args[3]);
398 bool should_have_fast_elements = fast_elements == 1; 398 bool should_have_fast_elements = fast_elements == 1;
399 399
400 Heap* heap = Isolate::Current()->heap();
401
400 // Check if boilerplate exists. If not, create it first. 402 // Check if boilerplate exists. If not, create it first.
401 Handle<Object> boilerplate(literals->get(literals_index)); 403 Handle<Object> boilerplate(literals->get(literals_index));
402 if (*boilerplate == HEAP->undefined_value()) { 404 if (*boilerplate == heap->undefined_value()) {
403 boilerplate = CreateObjectLiteralBoilerplate(literals, 405 boilerplate = CreateObjectLiteralBoilerplate(literals,
404 constant_properties, 406 constant_properties,
405 should_have_fast_elements); 407 should_have_fast_elements);
406 if (boilerplate.is_null()) return Failure::Exception(); 408 if (boilerplate.is_null()) return Failure::Exception();
407 // Update the functions literal and return the boilerplate. 409 // Update the functions literal and return the boilerplate.
408 literals->set(literals_index, *boilerplate); 410 literals->set(literals_index, *boilerplate);
409 } 411 }
410 return DeepCopyBoilerplate(HEAP, JSObject::cast(*boilerplate)); 412 return DeepCopyBoilerplate(heap, JSObject::cast(*boilerplate));
411 } 413 }
412 414
413 415
414 static Object* Runtime_CreateObjectLiteralShallow(Arguments args) { 416 static Object* Runtime_CreateObjectLiteralShallow(Arguments args) {
415 HandleScope scope; 417 HandleScope scope;
416 ASSERT(args.length() == 4); 418 ASSERT(args.length() == 4);
417 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 419 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
418 CONVERT_SMI_CHECKED(literals_index, args[1]); 420 CONVERT_SMI_CHECKED(literals_index, args[1]);
419 CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2); 421 CONVERT_ARG_CHECKED(FixedArray, constant_properties, 2);
420 CONVERT_SMI_CHECKED(fast_elements, args[3]); 422 CONVERT_SMI_CHECKED(fast_elements, args[3]);
421 bool should_have_fast_elements = fast_elements == 1; 423 bool should_have_fast_elements = fast_elements == 1;
422 424
425 Heap* heap = Isolate::Current()->heap();
426
423 // Check if boilerplate exists. If not, create it first. 427 // Check if boilerplate exists. If not, create it first.
424 Handle<Object> boilerplate(literals->get(literals_index)); 428 Handle<Object> boilerplate(literals->get(literals_index));
425 if (*boilerplate == HEAP->undefined_value()) { 429 if (*boilerplate == heap->undefined_value()) {
426 boilerplate = CreateObjectLiteralBoilerplate(literals, 430 boilerplate = CreateObjectLiteralBoilerplate(literals,
427 constant_properties, 431 constant_properties,
428 should_have_fast_elements); 432 should_have_fast_elements);
429 if (boilerplate.is_null()) return Failure::Exception(); 433 if (boilerplate.is_null()) return Failure::Exception();
430 // Update the functions literal and return the boilerplate. 434 // Update the functions literal and return the boilerplate.
431 literals->set(literals_index, *boilerplate); 435 literals->set(literals_index, *boilerplate);
432 } 436 }
433 return HEAP->CopyJSObject(JSObject::cast(*boilerplate)); 437 return heap->CopyJSObject(JSObject::cast(*boilerplate));
434 } 438 }
435 439
436 440
437 static Object* Runtime_CreateArrayLiteral(Arguments args) { 441 static Object* Runtime_CreateArrayLiteral(Arguments args) {
438 HandleScope scope; 442 HandleScope scope;
439 ASSERT(args.length() == 3); 443 ASSERT(args.length() == 3);
440 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 444 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
441 CONVERT_SMI_CHECKED(literals_index, args[1]); 445 CONVERT_SMI_CHECKED(literals_index, args[1]);
442 CONVERT_ARG_CHECKED(FixedArray, elements, 2); 446 CONVERT_ARG_CHECKED(FixedArray, elements, 2);
443 447
448 Heap* heap = Isolate::Current()->heap();
449
444 // Check if boilerplate exists. If not, create it first. 450 // Check if boilerplate exists. If not, create it first.
445 Handle<Object> boilerplate(literals->get(literals_index)); 451 Handle<Object> boilerplate(literals->get(literals_index));
446 if (*boilerplate == HEAP->undefined_value()) { 452 if (*boilerplate == heap->undefined_value()) {
447 boilerplate = CreateArrayLiteralBoilerplate(literals, elements); 453 boilerplate = CreateArrayLiteralBoilerplate(literals, elements);
448 if (boilerplate.is_null()) return Failure::Exception(); 454 if (boilerplate.is_null()) return Failure::Exception();
449 // Update the functions literal and return the boilerplate. 455 // Update the functions literal and return the boilerplate.
450 literals->set(literals_index, *boilerplate); 456 literals->set(literals_index, *boilerplate);
451 } 457 }
452 return DeepCopyBoilerplate(HEAP, JSObject::cast(*boilerplate)); 458 return DeepCopyBoilerplate(heap, JSObject::cast(*boilerplate));
453 } 459 }
454 460
455 461
456 static Object* Runtime_CreateArrayLiteralShallow(Arguments args) { 462 static Object* Runtime_CreateArrayLiteralShallow(Arguments args) {
457 HandleScope scope; 463 HandleScope scope;
458 ASSERT(args.length() == 3); 464 ASSERT(args.length() == 3);
459 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 465 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
460 CONVERT_SMI_CHECKED(literals_index, args[1]); 466 CONVERT_SMI_CHECKED(literals_index, args[1]);
461 CONVERT_ARG_CHECKED(FixedArray, elements, 2); 467 CONVERT_ARG_CHECKED(FixedArray, elements, 2);
462 468
469 Heap* heap = Isolate::Current()->heap();
470
463 // Check if boilerplate exists. If not, create it first. 471 // Check if boilerplate exists. If not, create it first.
464 Handle<Object> boilerplate(literals->get(literals_index)); 472 Handle<Object> boilerplate(literals->get(literals_index));
465 if (*boilerplate == HEAP->undefined_value()) { 473 if (*boilerplate == heap->undefined_value()) {
466 boilerplate = CreateArrayLiteralBoilerplate(literals, elements); 474 boilerplate = CreateArrayLiteralBoilerplate(literals, elements);
467 if (boilerplate.is_null()) return Failure::Exception(); 475 if (boilerplate.is_null()) return Failure::Exception();
468 // Update the functions literal and return the boilerplate. 476 // Update the functions literal and return the boilerplate.
469 literals->set(literals_index, *boilerplate); 477 literals->set(literals_index, *boilerplate);
470 } 478 }
471 return HEAP->CopyJSObject(JSObject::cast(*boilerplate)); 479 return heap->CopyJSObject(JSObject::cast(*boilerplate));
472 } 480 }
473 481
474 482
475 static Object* Runtime_CreateCatchExtensionObject(Arguments args) { 483 static Object* Runtime_CreateCatchExtensionObject(Arguments args) {
476 ASSERT(args.length() == 2); 484 ASSERT(args.length() == 2);
477 CONVERT_CHECKED(String, key, args[0]); 485 CONVERT_CHECKED(String, key, args[0]);
478 Object* value = args[1]; 486 Object* value = args[1];
479 // Create a catch context extension object. 487 // Create a catch context extension object.
480 JSFunction* constructor = 488 JSFunction* constructor =
481 Isolate::Current()->context()->global_context()-> 489 Isolate::Current()->context()->global_context()->
(...skipping 10126 matching lines...) Expand 10 before | Expand all | Expand 10 after
10608 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \ 10616 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \
10609 entries_[lut_index].method = &CodeGenerator::Generate##Name; \ 10617 entries_[lut_index].method = &CodeGenerator::Generate##Name; \
10610 entries_[lut_index].name = "_" #Name; \ 10618 entries_[lut_index].name = "_" #Name; \
10611 entries_[lut_index++].nargs = argc; 10619 entries_[lut_index++].nargs = argc;
10612 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES); 10620 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES);
10613 #undef SETUP_RUNTIME_ENTRIES 10621 #undef SETUP_RUNTIME_ENTRIES
10614 } 10622 }
10615 10623
10616 10624
10617 } } // namespace v8::internal 10625 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/prettyprinter.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698