| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   799         // The variable in the decl always resides in the current context. |   799         // The variable in the decl always resides in the current context. | 
|   800         ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |   800         ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 
|   801         if (FLAG_debug_code) { |   801         if (FLAG_debug_code) { | 
|   802           // Check if we have the correct context pointer. |   802           // Check if we have the correct context pointer. | 
|   803           __ mov(ebx, |   803           __ mov(ebx, | 
|   804                  CodeGenerator::ContextOperand(esi, Context::FCONTEXT_INDEX)); |   804                  CodeGenerator::ContextOperand(esi, Context::FCONTEXT_INDEX)); | 
|   805           __ cmp(ebx, Operand(esi)); |   805           __ cmp(ebx, Operand(esi)); | 
|   806           __ Check(equal, "Unexpected declaration in current context."); |   806           __ Check(equal, "Unexpected declaration in current context."); | 
|   807         } |   807         } | 
|   808         if (mode == Variable::CONST) { |   808         if (mode == Variable::CONST) { | 
|   809           __ mov(eax, Immediate(Factory::the_hole_value())); |   809           __ mov(CodeGenerator::ContextOperand(esi, slot->index()), | 
|   810           __ mov(CodeGenerator::ContextOperand(esi, slot->index()), eax); |   810                  Immediate(Factory::the_hole_value())); | 
|   811           // No write barrier since the hole value is in old space. |   811           // No write barrier since the hole value is in old space. | 
|   812         } else if (function != NULL) { |   812         } else if (function != NULL) { | 
|   813           VisitForValue(function, kAccumulator); |   813           VisitForValue(function, kAccumulator); | 
|   814           __ mov(CodeGenerator::ContextOperand(esi, slot->index()), |   814           __ mov(CodeGenerator::ContextOperand(esi, slot->index()), | 
|   815                  result_register()); |   815                  result_register()); | 
|   816           int offset = Context::SlotOffset(slot->index()); |   816           int offset = Context::SlotOffset(slot->index()); | 
|   817           __ mov(ebx, esi); |   817           __ mov(ebx, esi); | 
|   818           __ RecordWrite(ebx, offset, result_register(), ecx); |   818           __ RecordWrite(ebx, offset, result_register(), ecx); | 
|   819         } |   819         } | 
|   820         break; |   820         break; | 
|   821  |   821  | 
|   822       case Slot::LOOKUP: { |   822       case Slot::LOOKUP: { | 
|   823         __ push(esi); |   823         __ push(esi); | 
|   824         __ push(Immediate(variable->name())); |   824         __ push(Immediate(variable->name())); | 
|   825         // Declaration nodes are always introduced in one of two modes. |   825         // Declaration nodes are always introduced in one of two modes. | 
|   826         ASSERT(mode == Variable::VAR || |   826         ASSERT(mode == Variable::VAR || mode == Variable::CONST); | 
|   827                mode == Variable::CONST); |   827         PropertyAttributes attr = (mode == Variable::VAR) ? NONE : READ_ONLY; | 
|   828         PropertyAttributes attr = |  | 
|   829             (mode == Variable::VAR) ? NONE : READ_ONLY; |  | 
|   830         __ push(Immediate(Smi::FromInt(attr))); |   828         __ push(Immediate(Smi::FromInt(attr))); | 
|   831         // Push initial value, if any. |   829         // Push initial value, if any. | 
|   832         // Note: For variables we must not push an initial value (such as |   830         // Note: For variables we must not push an initial value (such as | 
|   833         // 'undefined') because we may have a (legal) redeclaration and we |   831         // 'undefined') because we may have a (legal) redeclaration and we | 
|   834         // must not destroy the current value. |   832         // must not destroy the current value. | 
|   835         if (mode == Variable::CONST) { |   833         if (mode == Variable::CONST) { | 
|   836           __ push(Immediate(Factory::the_hole_value())); |   834           __ push(Immediate(Factory::the_hole_value())); | 
|   837         } else if (function != NULL) { |   835         } else if (function != NULL) { | 
|   838           VisitForValue(function, kStack); |   836           VisitForValue(function, kStack); | 
|   839         } else { |   837         } else { | 
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1061   // Perform the assignment as if via '='. |  1059   // Perform the assignment as if via '='. | 
|  1062   EmitAssignment(stmt->each()); |  1060   EmitAssignment(stmt->each()); | 
|  1063  |  1061  | 
|  1064   // Generate code for the body of the loop. |  1062   // Generate code for the body of the loop. | 
|  1065   Label stack_limit_hit, stack_check_done; |  1063   Label stack_limit_hit, stack_check_done; | 
|  1066   Visit(stmt->body()); |  1064   Visit(stmt->body()); | 
|  1067  |  1065  | 
|  1068   __ StackLimitCheck(&stack_limit_hit); |  1066   __ StackLimitCheck(&stack_limit_hit); | 
|  1069   __ bind(&stack_check_done); |  1067   __ bind(&stack_check_done); | 
|  1070  |  1068  | 
|  1071   // Generate code for the going to the next element by incrementing |  1069   // Generate code for going to the next element by incrementing the | 
|  1072   // the index (smi) stored on top of the stack. |  1070   // index (smi) stored on top of the stack. | 
|  1073   __ bind(loop_statement.continue_target()); |  1071   __ bind(loop_statement.continue_target()); | 
|  1074   __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); |  1072   __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); | 
|  1075   __ jmp(&loop); |  1073   __ jmp(&loop); | 
|  1076  |  1074  | 
|  1077   // Slow case for the stack limit check. |  1075   // Slow case for the stack limit check. | 
|  1078   StackCheckStub stack_check_stub; |  1076   StackCheckStub stack_check_stub; | 
|  1079   __ bind(&stack_limit_hit); |  1077   __ bind(&stack_limit_hit); | 
|  1080   __ CallStub(&stack_check_stub); |  1078   __ CallStub(&stack_check_stub); | 
|  1081   __ jmp(&stack_check_done); |  1079   __ jmp(&stack_check_done); | 
|  1082  |  1080  | 
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2024   __ j(zero, if_false); |  2022   __ j(zero, if_false); | 
|  2025   __ cmp(eax, Factory::null_value()); |  2023   __ cmp(eax, Factory::null_value()); | 
|  2026   __ j(equal, if_true); |  2024   __ j(equal, if_true); | 
|  2027   __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |  2025   __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 
|  2028   // Undetectable objects behave like undefined when tested with typeof. |  2026   // Undetectable objects behave like undefined when tested with typeof. | 
|  2029   __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset)); |  2027   __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset)); | 
|  2030   __ test(ecx, Immediate(1 << Map::kIsUndetectable)); |  2028   __ test(ecx, Immediate(1 << Map::kIsUndetectable)); | 
|  2031   __ j(not_zero, if_false); |  2029   __ j(not_zero, if_false); | 
|  2032   __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |  2030   __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 
|  2033   __ cmp(ecx, FIRST_JS_OBJECT_TYPE); |  2031   __ cmp(ecx, FIRST_JS_OBJECT_TYPE); | 
|  2034   __ j(less, if_false); |  2032   __ j(below, if_false); | 
|  2035   __ cmp(ecx, LAST_JS_OBJECT_TYPE); |  2033   __ cmp(ecx, LAST_JS_OBJECT_TYPE); | 
|  2036   __ j(less_equal, if_true); |  2034   __ j(below_equal, if_true); | 
|  2037   __ jmp(if_false); |  2035   __ jmp(if_false); | 
|  2038  |  2036  | 
|  2039   Apply(context_, if_true, if_false); |  2037   Apply(context_, if_true, if_false); | 
|  2040 } |  2038 } | 
|  2041  |  2039  | 
|  2042  |  2040  | 
|  2043 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { |  2041 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { | 
|  2044   ASSERT(args->length() == 1); |  2042   ASSERT(args->length() == 1); | 
|  2045  |  2043  | 
|  2046   VisitForValue(args->at(0), kAccumulator); |  2044   VisitForValue(args->at(0), kAccumulator); | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2218  |  2216  | 
|  2219   // If the object is a smi, we return null. |  2217   // If the object is a smi, we return null. | 
|  2220   __ test(eax, Immediate(kSmiTagMask)); |  2218   __ test(eax, Immediate(kSmiTagMask)); | 
|  2221   __ j(zero, &null); |  2219   __ j(zero, &null); | 
|  2222  |  2220  | 
|  2223   // Check that the object is a JS object but take special care of JS |  2221   // Check that the object is a JS object but take special care of JS | 
|  2224   // functions to make sure they have 'Function' as their class. |  2222   // functions to make sure they have 'Function' as their class. | 
|  2225   __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |  2223   __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 
|  2226   __ movzx_b(ebx, FieldOperand(eax, Map::kInstanceTypeOffset)); |  2224   __ movzx_b(ebx, FieldOperand(eax, Map::kInstanceTypeOffset)); | 
|  2227   __ cmp(ebx, FIRST_JS_OBJECT_TYPE); |  2225   __ cmp(ebx, FIRST_JS_OBJECT_TYPE); | 
|  2228   __ j(less, &null); |  2226   __ j(below, &null); | 
|  2229  |  2227  | 
|  2230   // As long as JS_FUNCTION_TYPE is the last instance type and it is |  2228   // As long as JS_FUNCTION_TYPE is the last instance type and it is | 
|  2231   // right after LAST_JS_OBJECT_TYPE, we can avoid checking for |  2229   // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 
|  2232   // LAST_JS_OBJECT_TYPE. |  2230   // LAST_JS_OBJECT_TYPE. | 
|  2233   ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |  2231   ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 
|  2234   ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |  2232   ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 
|  2235   __ cmp(ebx, JS_FUNCTION_TYPE); |  2233   __ cmp(ebx, JS_FUNCTION_TYPE); | 
|  2236   __ j(equal, &function); |  2234   __ j(equal, &function); | 
|  2237  |  2235  | 
|  2238   // Check if the constructor in the map is a function. |  2236   // Check if the constructor in the map is a function. | 
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3238   // And return. |  3236   // And return. | 
|  3239   __ ret(0); |  3237   __ ret(0); | 
|  3240 } |  3238 } | 
|  3241  |  3239  | 
|  3242  |  3240  | 
|  3243 #undef __ |  3241 #undef __ | 
|  3244  |  3242  | 
|  3245 } }  // namespace v8::internal |  3243 } }  // namespace v8::internal | 
|  3246  |  3244  | 
|  3247 #endif  // V8_TARGET_ARCH_IA32 |  3245 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |