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

Side by Side Diff: src/objects.cc

Issue 7080053: Make instanceof and Object.getPrototypeOf work for proxies, plus a few other tweaks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (IsSmi()) { 631 if (IsSmi()) {
632 Heap* heap = Isolate::Current()->heap(); 632 Heap* heap = Isolate::Current()->heap();
633 Context* context = heap->isolate()->context()->global_context(); 633 Context* context = heap->isolate()->context()->global_context();
634 return context->number_function()->instance_prototype(); 634 return context->number_function()->instance_prototype();
635 } 635 }
636 636
637 HeapObject* heap_object = HeapObject::cast(this); 637 HeapObject* heap_object = HeapObject::cast(this);
638 638
639 // The object is either a number, a string, a boolean, 639 // The object is either a number, a string, a boolean,
640 // a real JS object, or a Harmony proxy. 640 // a real JS object, or a Harmony proxy.
641 if (heap_object->IsJSObject() || heap_object->IsJSProxy()) { 641 if (heap_object->IsJSReceiver()) {
642 return heap_object->map()->prototype(); 642 return heap_object->map()->prototype();
643 } 643 }
644 Heap* heap = heap_object->GetHeap(); 644 Heap* heap = heap_object->GetHeap();
645 Context* context = heap->isolate()->context()->global_context(); 645 Context* context = heap->isolate()->context()->global_context();
646 646
647 if (heap_object->IsHeapNumber()) { 647 if (heap_object->IsHeapNumber()) {
648 return context->number_function()->instance_prototype(); 648 return context->number_function()->instance_prototype();
649 } 649 }
650 if (heap_object->IsString()) { 650 if (heap_object->IsString()) {
651 return context->string_function()->instance_prototype(); 651 return context->string_function()->instance_prototype();
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 return JSObject::cast(proto)->LocalLookup(name, result); 3338 return JSObject::cast(proto)->LocalLookup(name, result);
3339 } 3339 }
3340 3340
3341 // Do not use inline caching if the object is a non-global object 3341 // Do not use inline caching if the object is a non-global object
3342 // that requires access checks. 3342 // that requires access checks.
3343 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) { 3343 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) {
3344 result->DisallowCaching(); 3344 result->DisallowCaching();
3345 } 3345 }
3346 3346
3347 // Check __proto__ before interceptor. 3347 // Check __proto__ before interceptor.
3348 if (name->Equals(heap->Proto_symbol()) && 3348 if (name->Equals(heap->Proto_symbol()) && !IsJSContextExtensionObject()) {
3349 !IsJSContextExtensionObject()) {
3350 result->ConstantResult(this); 3349 result->ConstantResult(this);
3351 return; 3350 return;
3352 } 3351 }
3353 3352
3354 // Check for lookup interceptor except when bootstrapping. 3353 // Check for lookup interceptor except when bootstrapping.
3355 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) { 3354 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) {
3356 result->InterceptorResult(this); 3355 result->InterceptorResult(this);
3357 return; 3356 return;
3358 } 3357 }
3359 3358
(...skipping 7350 matching lines...) Expand 10 before | Expand all | Expand 10 after
10710 if (break_point_objects()->IsUndefined()) return 0; 10709 if (break_point_objects()->IsUndefined()) return 0;
10711 // Single beak point. 10710 // Single beak point.
10712 if (!break_point_objects()->IsFixedArray()) return 1; 10711 if (!break_point_objects()->IsFixedArray()) return 1;
10713 // Multiple break points. 10712 // Multiple break points.
10714 return FixedArray::cast(break_point_objects())->length(); 10713 return FixedArray::cast(break_point_objects())->length();
10715 } 10714 }
10716 #endif 10715 #endif
10717 10716
10718 10717
10719 } } // namespace v8::internal 10718 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/objects-inl.h » ('j') | src/v8natives.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698