OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 UNREACHABLE(); | 366 UNREACHABLE(); |
367 return ::v8::internal::UNINITIALIZED; | 367 return ::v8::internal::UNINITIALIZED; |
368 } | 368 } |
369 | 369 |
370 | 370 |
371 Condition CompareICStub::GetCondition() const { | 371 Condition CompareICStub::GetCondition() const { |
372 return CompareIC::ComputeCondition(op()); | 372 return CompareIC::ComputeCondition(op()); |
373 } | 373 } |
374 | 374 |
375 | 375 |
| 376 void CompareICStub::AddToSpecialCache(Handle<Code> new_object) { |
| 377 DCHECK(*known_map_ != NULL); |
| 378 Isolate* isolate = new_object->GetIsolate(); |
| 379 Factory* factory = isolate->factory(); |
| 380 return Map::UpdateCodeCache(known_map_, |
| 381 strict() ? |
| 382 factory->strict_compare_ic_string() : |
| 383 factory->compare_ic_string(), |
| 384 new_object); |
| 385 } |
| 386 |
| 387 |
| 388 bool CompareICStub::FindCodeInSpecialCache(Code** code_out) { |
| 389 Code::Flags flags = Code::ComputeFlags( |
| 390 GetCodeKind(), |
| 391 UNINITIALIZED); |
| 392 Name* name = strict() ? isolate()->heap()->strict_compare_ic_string() |
| 393 : isolate()->heap()->compare_ic_string(); |
| 394 Code* code = known_map_->LookupInCodeCache(name, flags); |
| 395 if (code != nullptr) { |
| 396 *code_out = code; |
| 397 #ifdef DEBUG |
| 398 CompareICStub decode((*code_out)->stub_key(), isolate()); |
| 399 DCHECK(op() == decode.op()); |
| 400 DCHECK(left() == decode.left()); |
| 401 DCHECK(right() == decode.right()); |
| 402 DCHECK(state() == decode.state()); |
| 403 #endif |
| 404 return true; |
| 405 } |
| 406 return false; |
| 407 } |
| 408 |
| 409 |
376 void CompareICStub::Generate(MacroAssembler* masm) { | 410 void CompareICStub::Generate(MacroAssembler* masm) { |
377 switch (state()) { | 411 switch (state()) { |
378 case CompareICState::UNINITIALIZED: | 412 case CompareICState::UNINITIALIZED: |
379 GenerateMiss(masm); | 413 GenerateMiss(masm); |
380 break; | 414 break; |
381 case CompareICState::BOOLEAN: | 415 case CompareICState::BOOLEAN: |
382 GenerateBooleans(masm); | 416 GenerateBooleans(masm); |
383 break; | 417 break; |
384 case CompareICState::SMI: | 418 case CompareICState::SMI: |
385 GenerateSmis(masm); | 419 GenerateSmis(masm); |
(...skipping 4358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4744 if (type->Is(Type::UntaggedPointer())) { | 4778 if (type->Is(Type::UntaggedPointer())) { |
4745 return Representation::External(); | 4779 return Representation::External(); |
4746 } | 4780 } |
4747 | 4781 |
4748 DCHECK(!type->Is(Type::Untagged())); | 4782 DCHECK(!type->Is(Type::Untagged())); |
4749 return Representation::Tagged(); | 4783 return Representation::Tagged(); |
4750 } | 4784 } |
4751 | 4785 |
4752 } // namespace internal | 4786 } // namespace internal |
4753 } // namespace v8 | 4787 } // namespace v8 |
OLD | NEW |