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

Side by Side Diff: src/stub-cache.cc

Issue 12810006: Change LookupForWrite to always do a full lookup and check the result. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 KeyedLoadStubCompiler compiler(isolate_); 390 KeyedLoadStubCompiler compiler(isolate_);
391 Handle<Code> handler = 391 Handle<Code> handler =
392 compiler.CompileLoadCallback(receiver, holder, name, callback); 392 compiler.CompileLoadCallback(receiver, holder, name, callback);
393 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 393 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
394 return handler; 394 return handler;
395 } 395 }
396 396
397 397
398 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, 398 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name,
399 Handle<JSObject> receiver, 399 Handle<JSObject> receiver,
400 int field_index, 400 LookupResult* lookup,
401 Handle<Map> transition, 401 Handle<Map> transition,
402 StrictModeFlag strict_mode) { 402 StrictModeFlag strict_mode) {
403 Code::StubType type = 403 Code::StubType type =
404 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION; 404 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION;
405 405
406 Handle<Code> stub = FindIC( 406 Handle<Code> stub = FindIC(
407 name, receiver, Code::STORE_IC, type, strict_mode); 407 name, receiver, Code::STORE_IC, type, strict_mode);
408 if (!stub.is_null()) return stub; 408 if (!stub.is_null()) return stub;
409 409
410 StoreStubCompiler compiler(isolate_, strict_mode); 410 StoreStubCompiler compiler(isolate_, strict_mode);
411 Handle<Code> code = 411 Handle<Code> code =
412 compiler.CompileStoreField(receiver, field_index, transition, name); 412 compiler.CompileStoreField(receiver, lookup, transition, name);
413 JSObject::UpdateMapCodeCache(receiver, name, code); 413 JSObject::UpdateMapCodeCache(receiver, name, code);
414 return code; 414 return code;
415 } 415 }
416 416
417 417
418 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 418 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
419 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); 419 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
420 Handle<Name> name = 420 Handle<Name> name =
421 isolate()->factory()->KeyedLoadElementMonomorphic_string(); 421 isolate()->factory()->KeyedLoadElementMonomorphic_string();
422 422
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (!stub.is_null()) return stub; 525 if (!stub.is_null()) return stub;
526 526
527 StoreStubCompiler compiler(isolate_, strict_mode); 527 StoreStubCompiler compiler(isolate_, strict_mode);
528 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); 528 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name);
529 JSObject::UpdateMapCodeCache(receiver, name, code); 529 JSObject::UpdateMapCodeCache(receiver, name, code);
530 return code; 530 return code;
531 } 531 }
532 532
533 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, 533 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name,
534 Handle<JSObject> receiver, 534 Handle<JSObject> receiver,
535 int field_index, 535 LookupResult* lookup,
536 Handle<Map> transition, 536 Handle<Map> transition,
537 StrictModeFlag strict_mode) { 537 StrictModeFlag strict_mode) {
538 Code::StubType type = 538 Code::StubType type =
539 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; 539 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION;
540 Handle<Code> stub = FindIC( 540 Handle<Code> stub = FindIC(
541 name, receiver, Code::KEYED_STORE_IC, type, strict_mode); 541 name, receiver, Code::KEYED_STORE_IC, type, strict_mode);
542 if (!stub.is_null()) return stub; 542 if (!stub.is_null()) return stub;
543 543
544 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); 544 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
545 Handle<Code> code = 545 Handle<Code> code =
546 compiler.CompileStoreField(receiver, field_index, transition, name); 546 compiler.CompileStoreField(receiver, lookup, transition, name);
547 JSObject::UpdateMapCodeCache(receiver, name, code); 547 JSObject::UpdateMapCodeCache(receiver, name, code);
548 return code; 548 return code;
549 } 549 }
550 550
551 551
552 #define CALL_LOGGER_TAG(kind, type) \ 552 #define CALL_LOGGER_TAG(kind, type) \
553 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) 553 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type)
554 554
555 Handle<Code> StubCache::ComputeCallConstant(int argc, 555 Handle<Code> StubCache::ComputeCallConstant(int argc,
556 Code::Kind kind, 556 Code::Kind kind,
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1577
1578 __ bind(&success); 1578 __ bind(&success);
1579 GenerateLoadViaGetter(masm(), getter); 1579 GenerateLoadViaGetter(masm(), getter);
1580 1580
1581 // Return the generated code. 1581 // Return the generated code.
1582 return GetCode(kind(), Code::CALLBACKS, name); 1582 return GetCode(kind(), Code::CALLBACKS, name);
1583 } 1583 }
1584 1584
1585 1585
1586 Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object, 1586 Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object,
1587 int index, 1587 LookupResult* lookup,
1588 Handle<Map> transition, 1588 Handle<Map> transition,
1589 Handle<Name> name) { 1589 Handle<Name> name) {
1590 Label miss, miss_restore_name; 1590 Label miss, miss_restore_name;
1591 1591
1592 GenerateNameCheck(name, this->name(), &miss); 1592 GenerateNameCheck(name, this->name(), &miss);
1593 1593
1594 // Generate store field code. 1594 // Generate store field code.
1595 GenerateStoreField(masm(), 1595 GenerateStoreField(masm(),
1596 object, 1596 object,
1597 index, 1597 lookup,
1598 transition, 1598 transition,
1599 name, 1599 name,
1600 receiver(), this->name(), value(), scratch1(), scratch2(), 1600 receiver(), this->name(), value(), scratch1(), scratch2(),
1601 &miss, 1601 &miss,
1602 &miss_restore_name); 1602 &miss_restore_name);
1603 1603
1604 // Handle store cache miss. 1604 // Handle store cache miss.
1605 GenerateRestoreName(masm(), &miss_restore_name, name); 1605 GenerateRestoreName(masm(), &miss_restore_name, name);
1606 __ bind(&miss); 1606 __ bind(&miss);
1607 TailCallBuiltin(masm(), MissBuiltin(kind())); 1607 TailCallBuiltin(masm(), MissBuiltin(kind()));
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 Handle<FunctionTemplateInfo>( 2009 Handle<FunctionTemplateInfo>(
2010 FunctionTemplateInfo::cast(signature->receiver())); 2010 FunctionTemplateInfo::cast(signature->receiver()));
2011 } 2011 }
2012 } 2012 }
2013 2013
2014 is_simple_api_call_ = true; 2014 is_simple_api_call_ = true;
2015 } 2015 }
2016 2016
2017 2017
2018 } } // namespace v8::internal 2018 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698