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

Side by Side Diff: src/runtime.cc

Issue 11276028: Object.observe: implement map bit and functions to access it. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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') | 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 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 13204 matching lines...) Expand 10 before | Expand all | Expand 10 after
13215 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION 13215 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION
13216 13216
13217 13217
13218 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { 13218 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) {
13219 ASSERT(args.length() == 2); 13219 ASSERT(args.length() == 2);
13220 CONVERT_ARG_CHECKED(JSObject, obj1, 0); 13220 CONVERT_ARG_CHECKED(JSObject, obj1, 0);
13221 CONVERT_ARG_CHECKED(JSObject, obj2, 1); 13221 CONVERT_ARG_CHECKED(JSObject, obj2, 1);
13222 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); 13222 return isolate->heap()->ToBoolean(obj1->map() == obj2->map());
13223 } 13223 }
13224 13224
13225
13226 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) {
13227 ASSERT(args.length() == 1);
13228 CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
13229 return isolate->heap()->ToBoolean(obj->map()->is_observed());
13230 }
13231
13232
13233 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIsObserved) {
13234 ASSERT(args.length() == 2);
13235 CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
13236 CONVERT_BOOLEAN_ARG_CHECKED(is_observed, 1);
13237 if (obj->map()->is_observed() != is_observed) {
13238 MaybeObject* maybe = obj->map()->Copy();
13239 Map* map;
13240 if (!maybe->To<Map>(&map)) return maybe;
13241 map->set_is_observed(is_observed);
13242 obj->set_map(map);
13243 }
13244 return isolate->heap()->undefined_value();
13245 }
13246
13247
13225 // ---------------------------------------------------------------------------- 13248 // ----------------------------------------------------------------------------
13226 // Implementation of Runtime 13249 // Implementation of Runtime
13227 13250
13228 #define F(name, number_of_args, result_size) \ 13251 #define F(name, number_of_args, result_size) \
13229 { Runtime::k##name, Runtime::RUNTIME, #name, \ 13252 { Runtime::k##name, Runtime::RUNTIME, #name, \
13230 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, 13253 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size },
13231 13254
13232 13255
13233 #define I(name, number_of_args, result_size) \ 13256 #define I(name, number_of_args, result_size) \
13234 { Runtime::kInline##name, Runtime::INLINE, \ 13257 { Runtime::kInline##name, Runtime::INLINE, \
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
13301 // Handle last resort GC and make sure to allow future allocations 13324 // Handle last resort GC and make sure to allow future allocations
13302 // to grow the heap without causing GCs (if possible). 13325 // to grow the heap without causing GCs (if possible).
13303 isolate->counters()->gc_last_resort_from_js()->Increment(); 13326 isolate->counters()->gc_last_resort_from_js()->Increment();
13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13327 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13305 "Runtime::PerformGC"); 13328 "Runtime::PerformGC");
13306 } 13329 }
13307 } 13330 }
13308 13331
13309 13332
13310 } } // namespace v8::internal 13333 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698