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

Side by Side Diff: src/ic/handler-compiler.cc

Issue 962613002: add interceptors which do not mask existing properties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/api.cc ('k') | src/ic/ic.cc » ('j') | src/lookup-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/cpu-profiler.h" 7 #include "src/cpu-profiler.h"
8 #include "src/ic/call-optimization.h" 8 #include "src/ic/call-optimization.h"
9 #include "src/ic/handler-compiler.h" 9 #include "src/ic/handler-compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 Handle<Map> receiver_map = map(); 304 Handle<Map> receiver_map = map();
305 inline_followup = call_optimization.is_simple_api_call() && 305 inline_followup = call_optimization.is_simple_api_call() &&
306 call_optimization.IsCompatibleReceiverMap( 306 call_optimization.IsCompatibleReceiverMap(
307 receiver_map, property_holder); 307 receiver_map, property_holder);
308 } 308 }
309 } 309 }
310 } 310 }
311 311
312 Label miss; 312 Label miss;
313 InterceptorVectorSlotPush(receiver()); 313 InterceptorVectorSlotPush(receiver());
314 auto holder_orig = holder();
315 // Temporarily swap holder to check entire chain. What could go wrong?
316 if (holder()->GetNamedInterceptor()->non_masking()) {
317 DCHECK(!inline_followup);
318 JSObject* last = *holder();
319 PrototypeIterator iter(isolate(), last);
320 while (!iter.IsAtEnd()) {
321 last = JSObject::cast(iter.GetCurrent());
322 iter.Advance();
323 }
324 auto last_handle = handle(last);
325 set_holder(last_handle);
326 }
314 Register reg = FrontendHeader(receiver(), it->name(), &miss); 327 Register reg = FrontendHeader(receiver(), it->name(), &miss);
328 // Now do the check again, getting the holder into the right register...
329 if (holder_orig->GetNamedInterceptor()->non_masking()) {
330 set_holder(holder_orig);
331 reg = FrontendHeader(receiver(), it->name(), &miss);
332 }
315 FrontendFooter(it->name(), &miss); 333 FrontendFooter(it->name(), &miss);
316 InterceptorVectorSlotPop(reg); 334 InterceptorVectorSlotPop(reg);
317 335
318 if (inline_followup) { 336 if (inline_followup) {
319 // TODO(368): Compile in the whole chain: all the interceptors in 337 // TODO(368): Compile in the whole chain: all the interceptors in
320 // prototypes and ultimate answer. 338 // prototypes and ultimate answer.
321 GenerateLoadInterceptorWithFollowup(it, reg); 339 GenerateLoadInterceptorWithFollowup(it, reg);
322 } else { 340 } else {
341 // TODO(dcarney): add a function for calling nonmasking interceptors.
323 GenerateLoadInterceptor(reg); 342 GenerateLoadInterceptor(reg);
324 } 343 }
325 return GetCode(kind(), Code::FAST, it->name()); 344 return GetCode(kind(), Code::FAST, it->name());
326 } 345 }
327 346
328 347
329 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( 348 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
330 LookupIterator* it, Register interceptor_reg) { 349 LookupIterator* it, Register interceptor_reg) {
331 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>()); 350 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>());
332 351
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 DCHECK(elements_kind == DICTIONARY_ELEMENTS); 532 DCHECK(elements_kind == DICTIONARY_ELEMENTS);
514 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); 533 cached_stub = LoadDictionaryElementStub(isolate()).GetCode();
515 } 534 }
516 } 535 }
517 536
518 handlers->Add(cached_stub); 537 handlers->Add(cached_stub);
519 } 538 }
520 } 539 }
521 } 540 }
522 } // namespace v8::internal 541 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/ic/ic.cc » ('j') | src/lookup-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698