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

Side by Side Diff: src/runtime.cc

Issue 11274014: Store Object.observe state per-isolate rather than per-context (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use ObjectHashTable directly 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
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_GetObjectObservationState) {
13227 ASSERT(args.length() == 0);
13228 return isolate->heap()->object_observation_state();
13229 }
13230
13231
13232 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectHashTable) {
13233 HandleScope scope(isolate);
13234 ASSERT(args.length() == 0);
13235 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0);
13236 return *table;
13237 }
13238
13239
13240 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableGet) {
13241 HandleScope scope(isolate);
13242 ASSERT(args.length() == 2);
13243 CONVERT_ARG_HANDLE_CHECKED(ObjectHashTable, table, 0);
13244 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
13245 Handle<Object> lookup(table->Lookup(*key));
13246 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup;
13247 }
13248
13249
13250 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableSet) {
13251 HandleScope scope(isolate);
13252 ASSERT(args.length() == 3);
13253 CONVERT_ARG_HANDLE_CHECKED(ObjectHashTable, table, 0);
13254 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
13255 Handle<Object> value(args[2]);
13256 PutIntoObjectHashTable(table, key, value);
13257 return isolate->heap()->undefined_value();
13258 }
13259
13260
13261 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableHas) {
13262 HandleScope scope(isolate);
13263 ASSERT(args.length() == 2);
13264 CONVERT_ARG_HANDLE_CHECKED(ObjectHashTable, table, 0);
13265 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, key, 1);
13266 Handle<Object> lookup(table->Lookup(*key));
13267 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
13268 }
13269
13270
13225 // ---------------------------------------------------------------------------- 13271 // ----------------------------------------------------------------------------
13226 // Implementation of Runtime 13272 // Implementation of Runtime
13227 13273
13228 #define F(name, number_of_args, result_size) \ 13274 #define F(name, number_of_args, result_size) \
13229 { Runtime::k##name, Runtime::RUNTIME, #name, \ 13275 { Runtime::k##name, Runtime::RUNTIME, #name, \
13230 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, 13276 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size },
13231 13277
13232 13278
13233 #define I(name, number_of_args, result_size) \ 13279 #define I(name, number_of_args, result_size) \
13234 { Runtime::kInline##name, Runtime::INLINE, \ 13280 { 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 13347 // Handle last resort GC and make sure to allow future allocations
13302 // to grow the heap without causing GCs (if possible). 13348 // to grow the heap without causing GCs (if possible).
13303 isolate->counters()->gc_last_resort_from_js()->Increment(); 13349 isolate->counters()->gc_last_resort_from_js()->Increment();
13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13305 "Runtime::PerformGC"); 13351 "Runtime::PerformGC");
13306 } 13352 }
13307 } 13353 }
13308 13354
13309 13355
13310 } } // namespace v8::internal 13356 } } // namespace v8::internal
OLDNEW
« src/objects-inl.h ('K') | « src/runtime.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698