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

Side by Side Diff: src/runtime.cc

Issue 6932068: A first skeleton for introducing Harmony proxies (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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
« src/proxy.js ('K') | « src/runtime.h ('k') | src/runtime.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 literals->set(literals_index, *boilerplate); 581 literals->set(literals_index, *boilerplate);
582 } 582 }
583 if (JSObject::cast(*boilerplate)->elements()->map() == 583 if (JSObject::cast(*boilerplate)->elements()->map() ==
584 isolate->heap()->fixed_cow_array_map()) { 584 isolate->heap()->fixed_cow_array_map()) {
585 isolate->counters()->cow_arrays_created_runtime()->Increment(); 585 isolate->counters()->cow_arrays_created_runtime()->Increment();
586 } 586 }
587 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); 587 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate));
588 } 588 }
589 589
590 590
591 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) {
592 HandleScope scope(isolate);
Kevin Millikin (Chromium) 2011/05/13 08:08:30 We can remove this HandleScope and call the Heap::
rossberg 2011/05/13 09:21:53 Done.
593 ASSERT(args.length() == 2);
594 Handle<Object> handler = args.at<Object>(0);
595 Handle<Object> prototype = args.at<Object>(1);
596 Handle<Object> used_prototype =
597 (prototype->IsJSObject() || prototype->IsJSProxy()) ? prototype
598 : Handle<Object>(isolate->heap()->null_value());
599 return *isolate->factory()->NewJSProxy(handler, used_prototype);
600 }
601
602
591 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) { 603 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCatchExtensionObject) {
592 ASSERT(args.length() == 2); 604 ASSERT(args.length() == 2);
593 CONVERT_CHECKED(String, key, args[0]); 605 CONVERT_CHECKED(String, key, args[0]);
594 Object* value = args[1]; 606 Object* value = args[1];
595 // Create a catch context extension object. 607 // Create a catch context extension object.
596 JSFunction* constructor = 608 JSFunction* constructor =
597 isolate->context()->global_context()-> 609 isolate->context()->global_context()->
598 context_extension_function(); 610 context_extension_function();
599 Object* object; 611 Object* object;
600 { MaybeObject* maybe_object = isolate->heap()->AllocateJSObject(constructor); 612 { MaybeObject* maybe_object = isolate->heap()->AllocateJSObject(constructor);
(...skipping 11550 matching lines...) Expand 10 before | Expand all | Expand 10 after
12151 } else { 12163 } else {
12152 // Handle last resort GC and make sure to allow future allocations 12164 // Handle last resort GC and make sure to allow future allocations
12153 // to grow the heap without causing GCs (if possible). 12165 // to grow the heap without causing GCs (if possible).
12154 isolate->counters()->gc_last_resort_from_js()->Increment(); 12166 isolate->counters()->gc_last_resort_from_js()->Increment();
12155 isolate->heap()->CollectAllGarbage(false); 12167 isolate->heap()->CollectAllGarbage(false);
12156 } 12168 }
12157 } 12169 }
12158 12170
12159 12171
12160 } } // namespace v8::internal 12172 } } // namespace v8::internal
OLDNEW
« src/proxy.js ('K') | « src/runtime.h ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698