OLD | NEW |
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 496 |
497 if (check_type_ == RECEIVER_MAP_CHECK) { | 497 if (check_type_ == RECEIVER_MAP_CHECK) { |
498 // For primitive checks the holder is set up to point to the corresponding | 498 // For primitive checks the holder is set up to point to the corresponding |
499 // prototype object, i.e. one step of the algorithm below has been already | 499 // prototype object, i.e. one step of the algorithm below has been already |
500 // performed. For non-primitive checks we clear it to allow computing | 500 // performed. For non-primitive checks we clear it to allow computing |
501 // targets for polymorphic calls. | 501 // targets for polymorphic calls. |
502 holder_ = Handle<JSObject>::null(); | 502 holder_ = Handle<JSObject>::null(); |
503 } | 503 } |
504 LookupResult lookup(type->GetIsolate()); | 504 LookupResult lookup(type->GetIsolate()); |
505 while (true) { | 505 while (true) { |
506 type->LookupInDescriptors(NULL, *name, &lookup); | 506 type->LookupDescriptor(NULL, *name, &lookup); |
507 if (lookup.IsFound()) { | 507 if (lookup.IsFound()) { |
508 switch (lookup.type()) { | 508 switch (lookup.type()) { |
509 case CONSTANT_FUNCTION: | 509 case CONSTANT_FUNCTION: |
510 // We surely know the target for a constant function. | 510 // We surely know the target for a constant function. |
511 target_ = | 511 target_ = |
512 Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 512 Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
513 return true; | 513 return true; |
514 case NORMAL: | 514 case NORMAL: |
515 case FIELD: | 515 case FIELD: |
516 case CALLBACKS: | 516 case CALLBACKS: |
517 case HANDLER: | 517 case HANDLER: |
518 case INTERCEPTOR: | 518 case INTERCEPTOR: |
519 // We don't know the target. | 519 // We don't know the target. |
520 return false; | 520 return false; |
521 case MAP_TRANSITION: | 521 case TRANSITION: |
522 case CONSTANT_TRANSITION: | |
523 // Perhaps something interesting is up in the prototype chain... | |
524 break; | |
525 case NONEXISTENT: | 522 case NONEXISTENT: |
526 UNREACHABLE(); | 523 UNREACHABLE(); |
527 break; | 524 break; |
528 } | 525 } |
529 } | 526 } |
530 // If we reach the end of the prototype chain, we don't know the target. | 527 // If we reach the end of the prototype chain, we don't know the target. |
531 if (!type->prototype()->IsJSObject()) return false; | 528 if (!type->prototype()->IsJSObject()) return false; |
532 // Go up the prototype chain, recording where we are currently. | 529 // Go up the prototype chain, recording where we are currently. |
533 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); | 530 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); |
534 type = Handle<Map>(holder()->map()); | 531 type = Handle<Map>(holder()->map()); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); | 1115 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); |
1119 str = arr; | 1116 str = arr; |
1120 } else { | 1117 } else { |
1121 str = DoubleToCString(handle_->Number(), buffer); | 1118 str = DoubleToCString(handle_->Number(), buffer); |
1122 } | 1119 } |
1123 return FACTORY->NewStringFromAscii(CStrVector(str)); | 1120 return FACTORY->NewStringFromAscii(CStrVector(str)); |
1124 } | 1121 } |
1125 | 1122 |
1126 | 1123 |
1127 } } // namespace v8::internal | 1124 } } // namespace v8::internal |
OLD | NEW |