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 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 Split(cc, if_true, if_false, NULL); | 3018 Split(cc, if_true, if_false, NULL); |
3019 } | 3019 } |
3020 } | 3020 } |
3021 | 3021 |
3022 // Convert the result of the comparison into one expected for this | 3022 // Convert the result of the comparison into one expected for this |
3023 // expression's context. | 3023 // expression's context. |
3024 Apply(context_, if_true, if_false); | 3024 Apply(context_, if_true, if_false); |
3025 } | 3025 } |
3026 | 3026 |
3027 | 3027 |
| 3028 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { |
| 3029 Label materialize_true, materialize_false; |
| 3030 Label* if_true = NULL; |
| 3031 Label* if_false = NULL; |
| 3032 PrepareTest(&materialize_true, &materialize_false, &if_true, &if_false); |
| 3033 |
| 3034 VisitForValue(expr->expression(), kAccumulator); |
| 3035 __ cmp(eax, Factory::null_value()); |
| 3036 if (expr->is_strict()) { |
| 3037 Split(equal, if_true, if_false, NULL); |
| 3038 } else { |
| 3039 __ j(equal, if_true); |
| 3040 __ cmp(eax, Factory::undefined_value()); |
| 3041 __ j(equal, if_true); |
| 3042 __ test(eax, Immediate(kSmiTagMask)); |
| 3043 __ j(zero, if_false); |
| 3044 // It can be an undetectable object. |
| 3045 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 3046 __ movzx_b(edx, FieldOperand(edx, Map::kBitFieldOffset)); |
| 3047 __ test(edx, Immediate(1 << Map::kIsUndetectable)); |
| 3048 Split(not_zero, if_true, if_false, NULL); |
| 3049 } |
| 3050 Apply(context_, if_true, if_false); |
| 3051 } |
| 3052 |
| 3053 |
3028 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 3054 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
3029 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 3055 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
3030 Apply(context_, eax); | 3056 Apply(context_, eax); |
3031 } | 3057 } |
3032 | 3058 |
3033 | 3059 |
3034 Register FullCodeGenerator::result_register() { return eax; } | 3060 Register FullCodeGenerator::result_register() { return eax; } |
3035 | 3061 |
3036 | 3062 |
3037 Register FullCodeGenerator::context_register() { return esi; } | 3063 Register FullCodeGenerator::context_register() { return esi; } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 // And return. | 3103 // And return. |
3078 __ ret(0); | 3104 __ ret(0); |
3079 } | 3105 } |
3080 | 3106 |
3081 | 3107 |
3082 #undef __ | 3108 #undef __ |
3083 | 3109 |
3084 } } // namespace v8::internal | 3110 } } // namespace v8::internal |
3085 | 3111 |
3086 #endif // V8_TARGET_ARCH_IA32 | 3112 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |