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

Side by Side Diff: src/runtime.cc

Issue 7390028: Implement `in' for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 608 }
609 609
610 610
611 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) { 611 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHandler) {
612 ASSERT(args.length() == 1); 612 ASSERT(args.length() == 1);
613 CONVERT_CHECKED(JSProxy, proxy, args[0]); 613 CONVERT_CHECKED(JSProxy, proxy, args[0]);
614 return proxy->handler(); 614 return proxy->handler();
615 } 615 }
616 616
617 617
618 RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
619 ASSERT(args.length() == 1);
620 CONVERT_CHECKED(JSProxy, proxy, args[0]);
621 proxy->Fix();
622 return proxy;
623 }
624
625
618 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { 626 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
619 NoHandleAllocation ha; 627 NoHandleAllocation ha;
620 ASSERT(args.length() == 1); 628 ASSERT(args.length() == 1);
621 Object* obj = args[0]; 629 Object* obj = args[0];
622 if (!obj->IsJSObject()) return isolate->heap()->null_value(); 630 if (!obj->IsJSObject()) return isolate->heap()->null_value();
623 return JSObject::cast(obj)->class_name(); 631 return JSObject::cast(obj)->class_name();
624 } 632 }
625 633
626 634
627 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) { 635 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) {
(...skipping 3672 matching lines...) Expand 10 before | Expand all | Expand 10 after
4300 } 4308 }
4301 } 4309 }
4302 return isolate->heap()->false_value(); 4310 return isolate->heap()->false_value();
4303 } 4311 }
4304 4312
4305 4313
4306 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { 4314 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
4307 NoHandleAllocation na; 4315 NoHandleAllocation na;
4308 ASSERT(args.length() == 2); 4316 ASSERT(args.length() == 2);
4309 4317
4310 // Only JS objects can have properties. 4318 // Only JS receivers can have properties.
4311 if (args[0]->IsJSObject()) { 4319 if (args[0]->IsJSReceiver()) {
4312 JSObject* object = JSObject::cast(args[0]); 4320 JSReceiver* receiver = JSReceiver::cast(args[0]);
4313 CONVERT_CHECKED(String, key, args[1]); 4321 CONVERT_CHECKED(String, key, args[1]);
4314 if (object->HasProperty(key)) return isolate->heap()->true_value(); 4322 if (receiver->HasProperty(key)) return isolate->heap()->true_value();
4315 } 4323 }
4316 return isolate->heap()->false_value(); 4324 return isolate->heap()->false_value();
4317 } 4325 }
4318 4326
4319 4327
4320 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) { 4328 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) {
4321 NoHandleAllocation na; 4329 NoHandleAllocation na;
4322 ASSERT(args.length() == 2); 4330 ASSERT(args.length() == 2);
4323 4331
4324 // Only JS objects can have elements. 4332 // Only JS objects can have elements.
(...skipping 8345 matching lines...) Expand 10 before | Expand all | Expand 10 after
12670 } else { 12678 } else {
12671 // Handle last resort GC and make sure to allow future allocations 12679 // Handle last resort GC and make sure to allow future allocations
12672 // to grow the heap without causing GCs (if possible). 12680 // to grow the heap without causing GCs (if possible).
12673 isolate->counters()->gc_last_resort_from_js()->Increment(); 12681 isolate->counters()->gc_last_resort_from_js()->Increment();
12674 isolate->heap()->CollectAllGarbage(false); 12682 isolate->heap()->CollectAllGarbage(false);
12675 } 12683 }
12676 } 12684 }
12677 12685
12678 12686
12679 } } // namespace v8::internal 12687 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698