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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { | 169 Object* StubCache::ComputeLoadNormal(String* name, JSObject* receiver) { |
170 Code* code = Builtins::builtin(Builtins::LoadIC_Normal); | 170 Code* code = Builtins::builtin(Builtins::LoadIC_Normal); |
171 return Set(name, receiver->map(), code); | 171 return Set(name, receiver->map(), code); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 Object* StubCache::ComputeLoadGlobal(String* name, | 175 Object* StubCache::ComputeLoadGlobal(String* name, |
176 GlobalObject* receiver, | 176 JSObject* receiver, |
| 177 GlobalObject* holder, |
177 JSGlobalPropertyCell* cell, | 178 JSGlobalPropertyCell* cell, |
178 bool is_dont_delete) { | 179 bool is_dont_delete) { |
179 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 180 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
180 Object* code = receiver->map()->FindInCodeCache(name, flags); | 181 Object* code = receiver->map()->FindInCodeCache(name, flags); |
181 if (code->IsUndefined()) { | 182 if (code->IsUndefined()) { |
182 LoadStubCompiler compiler; | 183 LoadStubCompiler compiler; |
183 code = compiler.CompileLoadGlobal(receiver, cell, name, is_dont_delete); | 184 code = compiler.CompileLoadGlobal(receiver, |
| 185 holder, |
| 186 cell, |
| 187 name, |
| 188 is_dont_delete); |
184 if (code->IsFailure()) return code; | 189 if (code->IsFailure()) return code; |
185 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 190 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
186 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 191 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
187 if (result->IsFailure()) return code; | 192 if (result->IsFailure()) return code; |
188 } | 193 } |
189 return Set(name, receiver->map(), Code::cast(code)); | 194 return Set(name, receiver->map(), Code::cast(code)); |
190 } | 195 } |
191 | 196 |
192 | 197 |
193 Object* StubCache::ComputeKeyedLoadField(String* name, | 198 Object* StubCache::ComputeKeyedLoadField(String* name, |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 JSObject* receiver) { | 535 JSObject* receiver) { |
531 Object* code = ComputeCallNormal(argc, in_loop); | 536 Object* code = ComputeCallNormal(argc, in_loop); |
532 if (code->IsFailure()) return code; | 537 if (code->IsFailure()) return code; |
533 return Set(name, receiver->map(), Code::cast(code)); | 538 return Set(name, receiver->map(), Code::cast(code)); |
534 } | 539 } |
535 | 540 |
536 | 541 |
537 Object* StubCache::ComputeCallGlobal(int argc, | 542 Object* StubCache::ComputeCallGlobal(int argc, |
538 InLoopFlag in_loop, | 543 InLoopFlag in_loop, |
539 String* name, | 544 String* name, |
540 GlobalObject* receiver, | 545 JSObject* receiver, |
| 546 GlobalObject* holder, |
541 JSGlobalPropertyCell* cell, | 547 JSGlobalPropertyCell* cell, |
542 JSFunction* function) { | 548 JSFunction* function) { |
543 Code::Flags flags = | 549 Code::Flags flags = |
544 Code::ComputeMonomorphicFlags(Code::CALL_IC, NORMAL, in_loop, argc); | 550 Code::ComputeMonomorphicFlags(Code::CALL_IC, NORMAL, in_loop, argc); |
545 Object* code = receiver->map()->FindInCodeCache(name, flags); | 551 Object* code = receiver->map()->FindInCodeCache(name, flags); |
546 if (code->IsUndefined()) { | 552 if (code->IsUndefined()) { |
547 // If the function hasn't been compiled yet, we cannot do it now | 553 // If the function hasn't been compiled yet, we cannot do it now |
548 // because it may cause GC. To avoid this issue, we return an | 554 // because it may cause GC. To avoid this issue, we return an |
549 // internal error which will make sure we do not update any | 555 // internal error which will make sure we do not update any |
550 // caches. | 556 // caches. |
551 if (!function->is_compiled()) return Failure::InternalError(); | 557 if (!function->is_compiled()) return Failure::InternalError(); |
552 CallStubCompiler compiler(argc, in_loop); | 558 CallStubCompiler compiler(argc, in_loop); |
553 code = compiler.CompileCallGlobal(receiver, cell, function, name); | 559 code = compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
554 if (code->IsFailure()) return code; | 560 if (code->IsFailure()) return code; |
555 ASSERT_EQ(flags, Code::cast(code)->flags()); | 561 ASSERT_EQ(flags, Code::cast(code)->flags()); |
556 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 562 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
557 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 563 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
558 if (result->IsFailure()) return code; | 564 if (result->IsFailure()) return code; |
559 } | 565 } |
560 return Set(name, receiver->map(), Code::cast(code)); | 566 return Set(name, receiver->map(), Code::cast(code)); |
561 } | 567 } |
562 | 568 |
563 | 569 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 int argc = arguments_.immediate(); | 1005 int argc = arguments_.immediate(); |
1000 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 1006 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
1001 type, | 1007 type, |
1002 in_loop_, | 1008 in_loop_, |
1003 argc); | 1009 argc); |
1004 return GetCodeWithFlags(flags, name); | 1010 return GetCodeWithFlags(flags, name); |
1005 } | 1011 } |
1006 | 1012 |
1007 | 1013 |
1008 } } // namespace v8::internal | 1014 } } // namespace v8::internal |
OLD | NEW |