| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 check = StubCompiler::BOOLEAN_CHECK; | 428 check = StubCompiler::BOOLEAN_CHECK; |
| 429 } | 429 } |
| 430 | 430 |
| 431 Code::Flags flags = | 431 Code::Flags flags = |
| 432 Code::ComputeMonomorphicFlags(Code::CALL_IC, | 432 Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 433 CONSTANT_FUNCTION, | 433 CONSTANT_FUNCTION, |
| 434 in_loop, | 434 in_loop, |
| 435 argc); | 435 argc); |
| 436 Object* code = map->FindInCodeCache(name, flags); | 436 Object* code = map->FindInCodeCache(name, flags); |
| 437 if (code->IsUndefined()) { | 437 if (code->IsUndefined()) { |
| 438 if (object->IsJSObject()) { | |
| 439 Object* opt = | |
| 440 Top::LookupSpecialFunction(JSObject::cast(object), holder, function); | |
| 441 if (opt->IsJSFunction()) { | |
| 442 check = StubCompiler::JSARRAY_HAS_FAST_ELEMENTS_CHECK; | |
| 443 function = JSFunction::cast(opt); | |
| 444 } | |
| 445 } | |
| 446 // If the function hasn't been compiled yet, we cannot do it now | 438 // If the function hasn't been compiled yet, we cannot do it now |
| 447 // because it may cause GC. To avoid this issue, we return an | 439 // because it may cause GC. To avoid this issue, we return an |
| 448 // internal error which will make sure we do not update any | 440 // internal error which will make sure we do not update any |
| 449 // caches. | 441 // caches. |
| 450 if (!function->is_compiled()) return Failure::InternalError(); | 442 if (!function->is_compiled()) return Failure::InternalError(); |
| 451 // Compile the stub - only create stubs for fully compiled functions. | 443 // Compile the stub - only create stubs for fully compiled functions. |
| 452 CallStubCompiler compiler(argc, in_loop); | 444 CallStubCompiler compiler(argc, in_loop); |
| 453 code = compiler.CompileCallConstant(object, holder, function, name, check); | 445 code = compiler.CompileCallConstant(object, holder, function, name, check); |
| 454 if (code->IsFailure()) return code; | 446 if (code->IsFailure()) return code; |
| 455 ASSERT_EQ(flags, Code::cast(code)->flags()); | 447 ASSERT_EQ(flags, Code::cast(code)->flags()); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 if (!result->IsFailure()) { | 1118 if (!result->IsFailure()) { |
| 1127 Code* code = Code::cast(result); | 1119 Code* code = Code::cast(result); |
| 1128 USE(code); | 1120 USE(code); |
| 1129 LOG(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); | 1121 LOG(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); |
| 1130 } | 1122 } |
| 1131 return result; | 1123 return result; |
| 1132 } | 1124 } |
| 1133 | 1125 |
| 1134 | 1126 |
| 1135 } } // namespace v8::internal | 1127 } } // namespace v8::internal |
| OLD | NEW |