OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 5286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5297 __ movzx_b(ecx, FieldOperand(eax, Map::kInstanceTypeOffset)); // ecx - type | 5297 __ movzx_b(ecx, FieldOperand(eax, Map::kInstanceTypeOffset)); // ecx - type |
5298 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); | 5298 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); |
5299 __ j(less, &slow, not_taken); | 5299 __ j(less, &slow, not_taken); |
5300 __ cmp(ecx, LAST_JS_OBJECT_TYPE); | 5300 __ cmp(ecx, LAST_JS_OBJECT_TYPE); |
5301 __ j(greater, &slow, not_taken); | 5301 __ j(greater, &slow, not_taken); |
5302 | 5302 |
5303 // Get the prototype of the function. | 5303 // Get the prototype of the function. |
5304 __ mov(edx, Operand(esp, 1 * kPointerSize)); // 1 ~ return address | 5304 __ mov(edx, Operand(esp, 1 * kPointerSize)); // 1 ~ return address |
5305 __ TryGetFunctionPrototype(edx, ebx, ecx, &slow); | 5305 __ TryGetFunctionPrototype(edx, ebx, ecx, &slow); |
5306 | 5306 |
| 5307 // Check that the function prototype is a JS object. |
| 5308 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); |
| 5309 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 5310 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); |
| 5311 __ j(less, &slow, not_taken); |
| 5312 __ cmp(ecx, LAST_JS_OBJECT_TYPE); |
| 5313 __ j(greater, &slow, not_taken); |
| 5314 |
5307 // Register mapping: eax is object map and ebx is function prototype. | 5315 // Register mapping: eax is object map and ebx is function prototype. |
5308 __ mov(ecx, FieldOperand(eax, Map::kPrototypeOffset)); | 5316 __ mov(ecx, FieldOperand(eax, Map::kPrototypeOffset)); |
5309 | 5317 |
5310 // Loop through the prototype chain looking for the function prototype. | 5318 // Loop through the prototype chain looking for the function prototype. |
5311 Label loop, is_instance, is_not_instance; | 5319 Label loop, is_instance, is_not_instance; |
5312 __ bind(&loop); | 5320 __ bind(&loop); |
5313 __ cmp(ecx, Operand(ebx)); | 5321 __ cmp(ecx, Operand(ebx)); |
5314 __ j(equal, &is_instance); | 5322 __ j(equal, &is_instance); |
5315 __ cmp(Operand(ecx), Immediate(Factory::null_value())); | 5323 __ cmp(Operand(ecx), Immediate(Factory::null_value())); |
5316 __ j(equal, &is_not_instance); | 5324 __ j(equal, &is_not_instance); |
(...skipping 28 matching lines...) Expand all Loading... |
5345 bool is_eval) { | 5353 bool is_eval) { |
5346 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); | 5354 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); |
5347 if (!code.is_null()) { | 5355 if (!code.is_null()) { |
5348 Counters::total_compiled_code_size.Increment(code->instruction_size()); | 5356 Counters::total_compiled_code_size.Increment(code->instruction_size()); |
5349 } | 5357 } |
5350 return code; | 5358 return code; |
5351 } | 5359 } |
5352 | 5360 |
5353 | 5361 |
5354 } } // namespace v8::internal | 5362 } } // namespace v8::internal |
OLD | NEW |