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

Side by Side Diff: src/runtime.cc

Issue 14888005: Make Object.freeze fast (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle review comments Created 7 years, 7 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/runtime.h ('k') | src/v8natives.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); 2685 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
2686 int continuation = generator->continuation(); 2686 int continuation = generator->continuation();
2687 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ? 2687 const char* message = continuation == JSGeneratorObject::kGeneratorClosed ?
2688 "generator_finished" : "generator_running"; 2688 "generator_finished" : "generator_running";
2689 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0); 2689 Vector< Handle<Object> > argv = HandleVector<Object>(NULL, 0);
2690 Handle<Object> error = isolate->factory()->NewError(message, argv); 2690 Handle<Object> error = isolate->factory()->NewError(message, argv);
2691 return isolate->Throw(*error); 2691 return isolate->Throw(*error);
2692 } 2692 }
2693 2693
2694 2694
2695 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectFreeze) {
2696 NoHandleAllocation ha(isolate);
2697 ASSERT(args.length() == 1);
2698 CONVERT_ARG_CHECKED(JSObject, object, 0);
2699 return object->Freeze(isolate);
2700 }
2701
2702
2695 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate, 2703 MUST_USE_RESULT static MaybeObject* CharFromCode(Isolate* isolate,
2696 Object* char_code) { 2704 Object* char_code) {
2697 if (char_code->IsNumber()) { 2705 if (char_code->IsNumber()) {
2698 return isolate->heap()->LookupSingleCharacterStringFromCode( 2706 return isolate->heap()->LookupSingleCharacterStringFromCode(
2699 NumberToUint32(char_code) & 0xffff); 2707 NumberToUint32(char_code) & 0xffff);
2700 } 2708 }
2701 return isolate->heap()->empty_string(); 2709 return isolate->heap()->empty_string();
2702 } 2710 }
2703 2711
2704 2712
(...skipping 10593 matching lines...) Expand 10 before | Expand all | Expand 10 after
13298 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ 13306 CONVERT_ARG_CHECKED(JSObject, obj, 0); \
13299 return isolate->heap()->ToBoolean(obj->Has##Name()); \ 13307 return isolate->heap()->ToBoolean(obj->Has##Name()); \
13300 } 13308 }
13301 13309
13302 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) 13310 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements)
13303 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) 13311 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements)
13304 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) 13312 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements)
13305 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements) 13313 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements)
13306 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements) 13314 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
13307 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements) 13315 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
13316 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements)
13308 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalPixelElements) 13317 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalPixelElements)
13309 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements) 13318 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
13310 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalByteElements) 13319 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalByteElements)
13311 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedByteElements) 13320 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedByteElements)
13312 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalShortElements) 13321 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalShortElements)
13313 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedShortElements) 13322 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedShortElements)
13314 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalIntElements) 13323 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalIntElements)
13315 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedIntElements) 13324 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedIntElements)
13316 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalFloatElements) 13325 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalFloatElements)
13317 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements) 13326 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
13495 // Handle last resort GC and make sure to allow future allocations 13504 // Handle last resort GC and make sure to allow future allocations
13496 // to grow the heap without causing GCs (if possible). 13505 // to grow the heap without causing GCs (if possible).
13497 isolate->counters()->gc_last_resort_from_js()->Increment(); 13506 isolate->counters()->gc_last_resort_from_js()->Increment();
13498 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13507 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13499 "Runtime::PerformGC"); 13508 "Runtime::PerformGC");
13500 } 13509 }
13501 } 13510 }
13502 13511
13503 13512
13504 } } // namespace v8::internal 13513 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698