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 JSGlobalObject* receiver, | 176 GlobalObject* receiver, |
177 JSGlobalPropertyCell* cell, | 177 JSGlobalPropertyCell* cell, |
178 bool is_dont_delete) { | 178 bool is_dont_delete) { |
179 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 179 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
180 Object* code = receiver->map()->FindInCodeCache(name, flags); | 180 Object* code = receiver->map()->FindInCodeCache(name, flags); |
181 if (code->IsUndefined()) { | 181 if (code->IsUndefined()) { |
182 LoadStubCompiler compiler; | 182 LoadStubCompiler compiler; |
183 code = compiler.CompileLoadGlobal(receiver, cell, name, is_dont_delete); | 183 code = compiler.CompileLoadGlobal(receiver, cell, name, is_dont_delete); |
184 if (code->IsFailure()) return code; | 184 if (code->IsFailure()) return code; |
185 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 185 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
186 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 186 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (code->IsFailure()) return code; | 329 if (code->IsFailure()) return code; |
330 LOG(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 330 LOG(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
331 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 331 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
332 if (result->IsFailure()) return result; | 332 if (result->IsFailure()) return result; |
333 } | 333 } |
334 return Set(name, receiver->map(), Code::cast(code)); | 334 return Set(name, receiver->map(), Code::cast(code)); |
335 } | 335 } |
336 | 336 |
337 | 337 |
338 Object* StubCache::ComputeStoreGlobal(String* name, | 338 Object* StubCache::ComputeStoreGlobal(String* name, |
339 JSGlobalObject* receiver, | 339 GlobalObject* receiver, |
340 JSGlobalPropertyCell* cell) { | 340 JSGlobalPropertyCell* cell) { |
341 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 341 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
342 Object* code = receiver->map()->FindInCodeCache(name, flags); | 342 Object* code = receiver->map()->FindInCodeCache(name, flags); |
343 if (code->IsUndefined()) { | 343 if (code->IsUndefined()) { |
344 StoreStubCompiler compiler; | 344 StoreStubCompiler compiler; |
345 code = compiler.CompileStoreGlobal(receiver, cell, name); | 345 code = compiler.CompileStoreGlobal(receiver, cell, name); |
346 if (code->IsFailure()) return code; | 346 if (code->IsFailure()) return code; |
347 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 347 LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); |
348 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 348 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
349 if (result->IsFailure()) return code; | 349 if (result->IsFailure()) return code; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 JSObject* receiver) { | 530 JSObject* receiver) { |
531 Object* code = ComputeCallNormal(argc, in_loop); | 531 Object* code = ComputeCallNormal(argc, in_loop); |
532 if (code->IsFailure()) return code; | 532 if (code->IsFailure()) return code; |
533 return Set(name, receiver->map(), Code::cast(code)); | 533 return Set(name, receiver->map(), Code::cast(code)); |
534 } | 534 } |
535 | 535 |
536 | 536 |
537 Object* StubCache::ComputeCallGlobal(int argc, | 537 Object* StubCache::ComputeCallGlobal(int argc, |
538 InLoopFlag in_loop, | 538 InLoopFlag in_loop, |
539 String* name, | 539 String* name, |
540 JSGlobalObject* receiver, | 540 GlobalObject* receiver, |
541 JSGlobalPropertyCell* cell, | 541 JSGlobalPropertyCell* cell, |
542 JSFunction* function) { | 542 JSFunction* function) { |
543 Code::Flags flags = | 543 Code::Flags flags = |
544 Code::ComputeMonomorphicFlags(Code::CALL_IC, NORMAL, in_loop, argc); | 544 Code::ComputeMonomorphicFlags(Code::CALL_IC, NORMAL, in_loop, argc); |
545 Object* code = receiver->map()->FindInCodeCache(name, flags); | 545 Object* code = receiver->map()->FindInCodeCache(name, flags); |
546 if (code->IsUndefined()) { | 546 if (code->IsUndefined()) { |
547 // If the function hasn't been compiled yet, we cannot do it now | 547 // 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 | 548 // because it may cause GC. To avoid this issue, we return an |
549 // internal error which will make sure we do not update any | 549 // internal error which will make sure we do not update any |
550 // caches. | 550 // caches. |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 int argc = arguments_.immediate(); | 998 int argc = arguments_.immediate(); |
999 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 999 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
1000 type, | 1000 type, |
1001 in_loop_, | 1001 in_loop_, |
1002 argc); | 1002 argc); |
1003 return GetCodeWithFlags(flags, name); | 1003 return GetCodeWithFlags(flags, name); |
1004 } | 1004 } |
1005 | 1005 |
1006 | 1006 |
1007 } } // namespace v8::internal | 1007 } } // namespace v8::internal |
OLD | NEW |