| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 code = compiler.CompileLoadArrayLength(name); | 256 code = compiler.CompileLoadArrayLength(name); |
| 257 if (code->IsFailure()) return code; | 257 if (code->IsFailure()) return code; |
| 258 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); | 258 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); |
| 259 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 259 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
| 260 if (result->IsFailure()) return result; | 260 if (result->IsFailure()) return result; |
| 261 } | 261 } |
| 262 return code; | 262 return code; |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 Object* StubCache::ComputeKeyedLoadShortStringLength(String* name, | 266 Object* StubCache::ComputeKeyedLoadStringLength(String* name, |
| 267 String* receiver) { | 267 String* receiver) { |
| 268 Code::Flags flags = | 268 Code::Flags flags = |
| 269 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 269 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
| 270 Object* code = receiver->map()->FindInCodeCache(name, flags); | 270 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 271 if (code->IsUndefined()) { | 271 if (code->IsUndefined()) { |
| 272 KeyedLoadStubCompiler compiler; | 272 KeyedLoadStubCompiler compiler; |
| 273 code = compiler.CompileLoadShortStringLength(name); | 273 code = compiler.CompileLoadStringLength(name); |
| 274 if (code->IsFailure()) return code; | 274 if (code->IsFailure()) return code; |
| 275 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); | 275 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); |
| 276 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | 276 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); |
| 277 if (result->IsFailure()) return result; | 277 if (result->IsFailure()) return result; |
| 278 } | 278 } |
| 279 return code; | 279 return code; |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 Object* StubCache::ComputeKeyedLoadMediumStringLength(String* name, | |
| 284 String* receiver) { | |
| 285 Code::Flags flags = | |
| 286 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | |
| 287 Object* code = receiver->map()->FindInCodeCache(name, flags); | |
| 288 if (code->IsUndefined()) { | |
| 289 KeyedLoadStubCompiler compiler; | |
| 290 code = compiler.CompileLoadMediumStringLength(name); | |
| 291 if (code->IsFailure()) return code; | |
| 292 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); | |
| 293 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | |
| 294 if (result->IsFailure()) return result; | |
| 295 } | |
| 296 return code; | |
| 297 } | |
| 298 | |
| 299 | |
| 300 Object* StubCache::ComputeKeyedLoadLongStringLength(String* name, | |
| 301 String* receiver) { | |
| 302 Code::Flags flags = | |
| 303 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | |
| 304 Object* code = receiver->map()->FindInCodeCache(name, flags); | |
| 305 if (code->IsUndefined()) { | |
| 306 KeyedLoadStubCompiler compiler; | |
| 307 code = compiler.CompileLoadLongStringLength(name); | |
| 308 if (code->IsFailure()) return code; | |
| 309 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); | |
| 310 Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code)); | |
| 311 if (result->IsFailure()) return result; | |
| 312 } | |
| 313 return code; | |
| 314 } | |
| 315 | |
| 316 | |
| 317 Object* StubCache::ComputeKeyedLoadFunctionPrototype(String* name, | 283 Object* StubCache::ComputeKeyedLoadFunctionPrototype(String* name, |
| 318 JSFunction* receiver) { | 284 JSFunction* receiver) { |
| 319 Code::Flags flags = | 285 Code::Flags flags = |
| 320 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 286 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
| 321 Object* code = receiver->map()->FindInCodeCache(name, flags); | 287 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 322 if (code->IsUndefined()) { | 288 if (code->IsUndefined()) { |
| 323 KeyedLoadStubCompiler compiler; | 289 KeyedLoadStubCompiler compiler; |
| 324 code = compiler.CompileLoadFunctionPrototype(name); | 290 code = compiler.CompileLoadFunctionPrototype(name); |
| 325 if (code->IsFailure()) return code; | 291 if (code->IsFailure()) return code; |
| 326 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); | 292 LOG(CodeCreateEvent("KeyedLoadIC", Code::cast(code), name)); |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 914 |
| 949 | 915 |
| 950 Object* CallStubCompiler::GetCode(PropertyType type) { | 916 Object* CallStubCompiler::GetCode(PropertyType type) { |
| 951 int argc = arguments_.immediate(); | 917 int argc = arguments_.immediate(); |
| 952 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, type, argc); | 918 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, type, argc); |
| 953 return GetCodeWithFlags(flags); | 919 return GetCodeWithFlags(flags); |
| 954 } | 920 } |
| 955 | 921 |
| 956 | 922 |
| 957 } } // namespace v8::internal | 923 } } // namespace v8::internal |
| OLD | NEW |