OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 Handle<FixedArray> handler_table = | 255 Handle<FixedArray> handler_table = |
256 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); | 256 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); |
257 handler_table->set(0, Smi::FromInt(handler_offset_)); | 257 handler_table->set(0, Smi::FromInt(handler_offset_)); |
258 code->set_handler_table(*handler_table); | 258 code->set_handler_table(*handler_table); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 void KeyedLoadElementStub::Generate(MacroAssembler* masm) { | 262 void KeyedLoadElementStub::Generate(MacroAssembler* masm) { |
263 switch (elements_kind_) { | 263 switch (elements_kind_) { |
264 case FAST_ELEMENTS: | 264 case FAST_ELEMENTS: |
265 case FAST_HOLEY_ELEMENTS: | 265 case FAST_SMI_ONLY_ELEMENTS: |
266 case FAST_SMI_ELEMENTS: | |
267 case FAST_HOLEY_SMI_ELEMENTS: | |
268 KeyedLoadStubCompiler::GenerateLoadFastElement(masm); | 266 KeyedLoadStubCompiler::GenerateLoadFastElement(masm); |
269 break; | 267 break; |
270 case FAST_DOUBLE_ELEMENTS: | 268 case FAST_DOUBLE_ELEMENTS: |
271 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
272 KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(masm); | 269 KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(masm); |
273 break; | 270 break; |
274 case EXTERNAL_BYTE_ELEMENTS: | 271 case EXTERNAL_BYTE_ELEMENTS: |
275 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 272 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
276 case EXTERNAL_SHORT_ELEMENTS: | 273 case EXTERNAL_SHORT_ELEMENTS: |
277 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 274 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
278 case EXTERNAL_INT_ELEMENTS: | 275 case EXTERNAL_INT_ELEMENTS: |
279 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 276 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
280 case EXTERNAL_FLOAT_ELEMENTS: | 277 case EXTERNAL_FLOAT_ELEMENTS: |
281 case EXTERNAL_DOUBLE_ELEMENTS: | 278 case EXTERNAL_DOUBLE_ELEMENTS: |
282 case EXTERNAL_PIXEL_ELEMENTS: | 279 case EXTERNAL_PIXEL_ELEMENTS: |
283 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_); | 280 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, elements_kind_); |
284 break; | 281 break; |
285 case DICTIONARY_ELEMENTS: | 282 case DICTIONARY_ELEMENTS: |
286 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); | 283 KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); |
287 break; | 284 break; |
288 case NON_STRICT_ARGUMENTS_ELEMENTS: | 285 case NON_STRICT_ARGUMENTS_ELEMENTS: |
289 UNREACHABLE(); | 286 UNREACHABLE(); |
290 break; | 287 break; |
291 } | 288 } |
292 } | 289 } |
293 | 290 |
294 | 291 |
295 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { | 292 void KeyedStoreElementStub::Generate(MacroAssembler* masm) { |
296 switch (elements_kind_) { | 293 switch (elements_kind_) { |
297 case FAST_ELEMENTS: | 294 case FAST_ELEMENTS: |
298 case FAST_HOLEY_ELEMENTS: | 295 case FAST_SMI_ONLY_ELEMENTS: { |
299 case FAST_SMI_ELEMENTS: | |
300 case FAST_HOLEY_SMI_ELEMENTS: { | |
301 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, | 296 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, |
302 is_js_array_, | 297 is_js_array_, |
303 elements_kind_, | 298 elements_kind_, |
304 grow_mode_); | 299 grow_mode_); |
305 } | 300 } |
306 break; | 301 break; |
307 case FAST_DOUBLE_ELEMENTS: | 302 case FAST_DOUBLE_ELEMENTS: |
308 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
309 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, | 303 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, |
310 is_js_array_, | 304 is_js_array_, |
311 grow_mode_); | 305 grow_mode_); |
312 break; | 306 break; |
313 case EXTERNAL_BYTE_ELEMENTS: | 307 case EXTERNAL_BYTE_ELEMENTS: |
314 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 308 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
315 case EXTERNAL_SHORT_ELEMENTS: | 309 case EXTERNAL_SHORT_ELEMENTS: |
316 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 310 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
317 case EXTERNAL_INT_ELEMENTS: | 311 case EXTERNAL_INT_ELEMENTS: |
318 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 312 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 423 |
430 | 424 |
431 bool ToBooleanStub::Types::CanBeUndetectable() const { | 425 bool ToBooleanStub::Types::CanBeUndetectable() const { |
432 return Contains(ToBooleanStub::SPEC_OBJECT) | 426 return Contains(ToBooleanStub::SPEC_OBJECT) |
433 || Contains(ToBooleanStub::STRING); | 427 || Contains(ToBooleanStub::STRING); |
434 } | 428 } |
435 | 429 |
436 | 430 |
437 void ElementsTransitionAndStoreStub::Generate(MacroAssembler* masm) { | 431 void ElementsTransitionAndStoreStub::Generate(MacroAssembler* masm) { |
438 Label fail; | 432 Label fail; |
439 ASSERT(!IsFastHoleyElementsKind(from_) || IsFastHoleyElementsKind(to_)); | |
440 if (!FLAG_trace_elements_transitions) { | 433 if (!FLAG_trace_elements_transitions) { |
441 if (IsFastSmiOrObjectElementsKind(to_)) { | 434 if (to_ == FAST_ELEMENTS) { |
442 if (IsFastSmiOrObjectElementsKind(from_)) { | 435 if (from_ == FAST_SMI_ONLY_ELEMENTS) { |
443 ElementsTransitionGenerator:: | 436 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm); |
444 GenerateMapChangeElementsTransition(masm); | 437 } else if (from_ == FAST_DOUBLE_ELEMENTS) { |
445 } else if (IsFastDoubleElementsKind(from_)) { | |
446 ASSERT(!IsFastSmiElementsKind(to_)); | |
447 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail); | 438 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail); |
448 } else { | 439 } else { |
449 UNREACHABLE(); | 440 UNREACHABLE(); |
450 } | 441 } |
451 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, | 442 KeyedStoreStubCompiler::GenerateStoreFastElement(masm, |
452 is_jsarray_, | 443 is_jsarray_, |
453 to_, | 444 FAST_ELEMENTS, |
454 grow_mode_); | 445 grow_mode_); |
455 } else if (IsFastSmiElementsKind(from_) && | 446 } else if (from_ == FAST_SMI_ONLY_ELEMENTS && to_ == FAST_DOUBLE_ELEMENTS) { |
456 IsFastDoubleElementsKind(to_)) { | 447 ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &fail); |
457 ElementsTransitionGenerator::GenerateSmiToDouble(masm, &fail); | |
458 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, | 448 KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(masm, |
459 is_jsarray_, | 449 is_jsarray_, |
460 grow_mode_); | 450 grow_mode_); |
461 } else if (IsFastDoubleElementsKind(from_)) { | |
462 ASSERT(to_ == FAST_HOLEY_DOUBLE_ELEMENTS); | |
463 ElementsTransitionGenerator:: | |
464 GenerateMapChangeElementsTransition(masm); | |
465 } else { | 451 } else { |
466 UNREACHABLE(); | 452 UNREACHABLE(); |
467 } | 453 } |
468 } | 454 } |
469 masm->bind(&fail); | 455 masm->bind(&fail); |
470 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); | 456 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); |
471 } | 457 } |
472 | 458 |
473 } } // namespace v8::internal | 459 } } // namespace v8::internal |
OLD | NEW |