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

Side by Side Diff: src/objects.cc

Issue 7056041: Reapply: "Make instanceof and Object.getPrototypeOf work for proxies, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix for Runtime_GetPrototype 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 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 return JSObject::cast(proto)->LocalLookup(name, result); 3373 return JSObject::cast(proto)->LocalLookup(name, result);
3374 } 3374 }
3375 3375
3376 // Do not use inline caching if the object is a non-global object 3376 // Do not use inline caching if the object is a non-global object
3377 // that requires access checks. 3377 // that requires access checks.
3378 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) { 3378 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) {
3379 result->DisallowCaching(); 3379 result->DisallowCaching();
3380 } 3380 }
3381 3381
3382 // Check __proto__ before interceptor. 3382 // Check __proto__ before interceptor.
3383 if (name->Equals(heap->Proto_symbol()) && 3383 if (name->Equals(heap->Proto_symbol()) && !IsJSContextExtensionObject()) {
3384 !IsJSContextExtensionObject()) {
3385 result->ConstantResult(this); 3384 result->ConstantResult(this);
3386 return; 3385 return;
3387 } 3386 }
3388 3387
3389 // Check for lookup interceptor except when bootstrapping. 3388 // Check for lookup interceptor except when bootstrapping.
3390 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) { 3389 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) {
3391 result->InterceptorResult(this); 3390 result->InterceptorResult(this);
3392 return; 3391 return;
3393 } 3392 }
3394 3393
(...skipping 7350 matching lines...) Expand 10 before | Expand all | Expand 10 after
10745 if (break_point_objects()->IsUndefined()) return 0; 10744 if (break_point_objects()->IsUndefined()) return 0;
10746 // Single beak point. 10745 // Single beak point.
10747 if (!break_point_objects()->IsFixedArray()) return 1; 10746 if (!break_point_objects()->IsFixedArray()) return 1;
10748 // Multiple break points. 10747 // Multiple break points.
10749 return FixedArray::cast(break_point_objects())->length(); 10748 return FixedArray::cast(break_point_objects())->length();
10750 } 10749 }
10751 #endif 10750 #endif
10752 10751
10753 10752
10754 } } // namespace v8::internal 10753 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/objects-inl.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698