| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6399 // ControlDestination, so we copy its implementation here. | 6399 // ControlDestination, so we copy its implementation here. |
| 6400 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset)); | 6400 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset)); |
| 6401 __ sub(Operand(map.reg()), Immediate(FIRST_JS_OBJECT_TYPE)); | 6401 __ sub(Operand(map.reg()), Immediate(FIRST_JS_OBJECT_TYPE)); |
| 6402 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); | 6402 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); |
| 6403 obj.Unuse(); | 6403 obj.Unuse(); |
| 6404 map.Unuse(); | 6404 map.Unuse(); |
| 6405 destination()->Split(below_equal); | 6405 destination()->Split(below_equal); |
| 6406 } | 6406 } |
| 6407 | 6407 |
| 6408 | 6408 |
| 6409 void CodeGenerator::GenerateIsSpecObject(ZoneList<Expression*>* args) { |
| 6410 // This generates a fast version of: |
| 6411 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp' || |
| 6412 // typeof(arg) == function). |
| 6413 // It includes undetectable objects (as opposed to IsObject). |
| 6414 ASSERT(args->length() == 1); |
| 6415 Load(args->at(0)); |
| 6416 Result value = frame_->Pop(); |
| 6417 value.ToRegister(); |
| 6418 ASSERT(value.is_valid()); |
| 6419 __ test(value.reg(), Immediate(kSmiTagMask)); |
| 6420 destination()->false_target()->Branch(equal); |
| 6421 |
| 6422 // Check that this is an object. |
| 6423 frame_->Spill(value.reg()); |
| 6424 __ CmpObjectType(value.reg(), FIRST_JS_OBJECT_TYPE, value.reg()); |
| 6425 value.Unuse(); |
| 6426 destination()->Split(above_equal); |
| 6427 } |
| 6428 |
| 6429 |
| 6409 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { | 6430 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { |
| 6410 // This generates a fast version of: | 6431 // This generates a fast version of: |
| 6411 // (%_ClassOf(arg) === 'Function') | 6432 // (%_ClassOf(arg) === 'Function') |
| 6412 ASSERT(args->length() == 1); | 6433 ASSERT(args->length() == 1); |
| 6413 Load(args->at(0)); | 6434 Load(args->at(0)); |
| 6414 Result obj = frame_->Pop(); | 6435 Result obj = frame_->Pop(); |
| 6415 obj.ToRegister(); | 6436 obj.ToRegister(); |
| 6416 __ test(obj.reg(), Immediate(kSmiTagMask)); | 6437 __ test(obj.reg(), Immediate(kSmiTagMask)); |
| 6417 destination()->false_target()->Branch(zero); | 6438 destination()->false_target()->Branch(zero); |
| 6418 Result temp = allocator()->Allocate(); | 6439 Result temp = allocator()->Allocate(); |
| (...skipping 7336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13755 masm.GetCode(&desc); | 13776 masm.GetCode(&desc); |
| 13756 // Call the function from C++. | 13777 // Call the function from C++. |
| 13757 return FUNCTION_CAST<MemCopyFunction>(buffer); | 13778 return FUNCTION_CAST<MemCopyFunction>(buffer); |
| 13758 } | 13779 } |
| 13759 | 13780 |
| 13760 #undef __ | 13781 #undef __ |
| 13761 | 13782 |
| 13762 } } // namespace v8::internal | 13783 } } // namespace v8::internal |
| 13763 | 13784 |
| 13764 #endif // V8_TARGET_ARCH_IA32 | 13785 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |