Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/ic/ic.h

Issue 2184063002: [stubs] Cleanup CodeFactory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IC_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 class CallIC : public IC { 254 class CallIC : public IC {
255 public: 255 public:
256 CallIC(Isolate* isolate, CallICNexus* nexus) 256 CallIC(Isolate* isolate, CallICNexus* nexus)
257 : IC(EXTRA_CALL_FRAME, isolate, nexus) { 257 : IC(EXTRA_CALL_FRAME, isolate, nexus) {
258 DCHECK(nexus != NULL); 258 DCHECK(nexus != NULL);
259 } 259 }
260 260
261 void HandleMiss(Handle<Object> function); 261 void HandleMiss(Handle<Object> function);
262 262
263 // Code generator routines.
264 static Handle<Code> initialize_stub_in_optimized_code(
265 Isolate* isolate, int argc, ConvertReceiverMode mode,
266 TailCallMode tail_call_mode);
267
268 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); 263 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus);
269 }; 264 };
270 265
271 266
272 class LoadIC : public IC { 267 class LoadIC : public IC {
273 public: 268 public:
274 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 269 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
275 : IC(depth, isolate, nexus) { 270 : IC(depth, isolate, nexus) {
276 DCHECK(nexus != NULL); 271 DCHECK(nexus != NULL);
277 DCHECK(IsLoadStub()); 272 DCHECK(IsLoadStub());
278 } 273 }
279 274
280 bool ShouldThrowReferenceError() const { 275 bool ShouldThrowReferenceError() const {
281 return kind() == Code::LOAD_GLOBAL_IC && 276 return kind() == Code::LOAD_GLOBAL_IC &&
282 LoadGlobalICState::GetTypeofMode(extra_ic_state()) == 277 LoadGlobalICState::GetTypeofMode(extra_ic_state()) ==
283 NOT_INSIDE_TYPEOF; 278 NOT_INSIDE_TYPEOF;
284 } 279 }
285 280
286 // Code generator routines. 281 // Code generator routines.
287 282
288 static void GenerateMiss(MacroAssembler* masm); 283 static void GenerateMiss(MacroAssembler* masm);
289 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 284 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
290 static void GenerateNormal(MacroAssembler* masm); 285 static void GenerateNormal(MacroAssembler* masm);
291 286
292 static Handle<Code> initialize_stub_in_optimized_code(Isolate* isolate);
293
294 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 287 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
295 Handle<Name> name); 288 Handle<Name> name);
296 289
297 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus); 290 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus);
298 291
299 protected: 292 protected:
300 virtual Handle<Code> slow_stub() const { 293 virtual Handle<Code> slow_stub() const {
301 return isolate()->builtins()->LoadIC_Slow(); 294 return isolate()->builtins()->LoadIC_Slow();
302 } 295 }
303 296
(...skipping 10 matching lines...) Expand all
314 Handle<Object> SimpleFieldLoad(FieldIndex index); 307 Handle<Object> SimpleFieldLoad(FieldIndex index);
315 308
316 friend class IC; 309 friend class IC;
317 }; 310 };
318 311
319 class LoadGlobalIC : public LoadIC { 312 class LoadGlobalIC : public LoadIC {
320 public: 313 public:
321 LoadGlobalIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 314 LoadGlobalIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
322 : LoadIC(depth, isolate, nexus) {} 315 : LoadIC(depth, isolate, nexus) {}
323 316
324 static Handle<Code> initialize_stub_in_optimized_code(
325 Isolate* isolate, ExtraICState extra_state);
326
327 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Name> name); 317 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Name> name);
328 318
329 static void Clear(Isolate* isolate, Code* host, LoadGlobalICNexus* nexus); 319 static void Clear(Isolate* isolate, Code* host, LoadGlobalICNexus* nexus);
330 320
331 protected: 321 protected:
332 Handle<Code> slow_stub() const override { 322 Handle<Code> slow_stub() const override {
333 if (LoadGlobalICState::GetTypeofMode(extra_ic_state()) == 323 if (LoadGlobalICState::GetTypeofMode(extra_ic_state()) ==
334 NOT_INSIDE_TYPEOF) { 324 NOT_INSIDE_TYPEOF) {
335 return isolate()->builtins()->LoadGlobalIC_SlowNotInsideTypeof(); 325 return isolate()->builtins()->LoadGlobalIC_SlowNotInsideTypeof();
336 } else { 326 } else {
(...skipping 11 matching lines...) Expand all
348 } 338 }
349 339
350 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 340 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
351 Handle<Object> key); 341 Handle<Object> key);
352 342
353 // Code generator routines. 343 // Code generator routines.
354 static void GenerateMiss(MacroAssembler* masm); 344 static void GenerateMiss(MacroAssembler* masm);
355 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 345 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
356 static void GenerateMegamorphic(MacroAssembler* masm); 346 static void GenerateMegamorphic(MacroAssembler* masm);
357 347
358 static Handle<Code> initialize_stub_in_optimized_code(Isolate* isolate);
359 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate, 348 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate,
360 ExtraICState extra_state); 349 ExtraICState extra_state);
361 350
362 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus); 351 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus);
363 352
364 protected: 353 protected:
365 // receiver is HeapObject because it could be a String or a JSObject 354 // receiver is HeapObject because it could be a String or a JSObject
366 void UpdateLoadElement(Handle<HeapObject> receiver); 355 void UpdateLoadElement(Handle<HeapObject> receiver);
367 356
368 private: 357 private:
(...skipping 10 matching lines...) Expand all
379 368
380 LanguageMode language_mode() const { 369 LanguageMode language_mode() const {
381 return StoreICState::GetLanguageMode(extra_ic_state()); 370 return StoreICState::GetLanguageMode(extra_ic_state());
382 } 371 }
383 372
384 // Code generators for stub routines. Only called once at startup. 373 // Code generators for stub routines. Only called once at startup.
385 static void GenerateSlow(MacroAssembler* masm); 374 static void GenerateSlow(MacroAssembler* masm);
386 static void GenerateMiss(MacroAssembler* masm); 375 static void GenerateMiss(MacroAssembler* masm);
387 static void GenerateNormal(MacroAssembler* masm); 376 static void GenerateNormal(MacroAssembler* masm);
388 377
389 static Handle<Code> initialize_stub_in_optimized_code(
390 Isolate* isolate, LanguageMode language_mode);
391
392 MUST_USE_RESULT MaybeHandle<Object> Store( 378 MUST_USE_RESULT MaybeHandle<Object> Store(
393 Handle<Object> object, Handle<Name> name, Handle<Object> value, 379 Handle<Object> object, Handle<Name> name, Handle<Object> value,
394 JSReceiver::StoreFromKeyed store_mode = 380 JSReceiver::StoreFromKeyed store_mode =
395 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); 381 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
396 382
397 bool LookupForWrite(LookupIterator* it, Handle<Object> value, 383 bool LookupForWrite(LookupIterator* it, Handle<Object> value,
398 JSReceiver::StoreFromKeyed store_mode); 384 JSReceiver::StoreFromKeyed store_mode);
399 385
400 static void Clear(Isolate* isolate, Code* host, StoreICNexus* nexus); 386 static void Clear(Isolate* isolate, Code* host, StoreICNexus* nexus);
401 387
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, 431 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object,
446 Handle<Object> name, 432 Handle<Object> name,
447 Handle<Object> value); 433 Handle<Object> value);
448 434
449 // Code generators for stub routines. Only called once at startup. 435 // Code generators for stub routines. Only called once at startup.
450 static void GenerateMiss(MacroAssembler* masm); 436 static void GenerateMiss(MacroAssembler* masm);
451 static void GenerateSlow(MacroAssembler* masm); 437 static void GenerateSlow(MacroAssembler* masm);
452 static void GenerateMegamorphic(MacroAssembler* masm, 438 static void GenerateMegamorphic(MacroAssembler* masm,
453 LanguageMode language_mode); 439 LanguageMode language_mode);
454 440
455 static Handle<Code> initialize_stub_in_optimized_code(
456 Isolate* isolate, LanguageMode language_mode);
457 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate, 441 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate,
458 ExtraICState extra_state); 442 ExtraICState extra_state);
459 443
460 static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus); 444 static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus);
461 445
462 protected: 446 protected:
463 void UpdateStoreElement(Handle<Map> receiver_map, 447 void UpdateStoreElement(Handle<Map> receiver_map,
464 KeyedAccessStoreMode store_mode); 448 KeyedAccessStoreMode store_mode);
465 449
466 private: 450 private:
(...skipping 19 matching lines...) Expand all
486 public: 470 public:
487 CompareIC(Isolate* isolate, Token::Value op) 471 CompareIC(Isolate* isolate, Token::Value op)
488 : IC(EXTRA_CALL_FRAME, isolate), op_(op) {} 472 : IC(EXTRA_CALL_FRAME, isolate), op_(op) {}
489 473
490 // Update the inline cache for the given operands. 474 // Update the inline cache for the given operands.
491 Code* UpdateCaches(Handle<Object> x, Handle<Object> y); 475 Code* UpdateCaches(Handle<Object> x, Handle<Object> y);
492 476
493 // Helper function for computing the condition for a compare operation. 477 // Helper function for computing the condition for a compare operation.
494 static Condition ComputeCondition(Token::Value op); 478 static Condition ComputeCondition(Token::Value op);
495 479
496 // Factory method for getting an uninitialized compare stub.
497 static Handle<Code> GetUninitialized(Isolate* isolate, Token::Value op);
498
499 private: 480 private:
500 static bool HasInlinedSmiCode(Address address); 481 static bool HasInlinedSmiCode(Address address);
501 482
502 bool strict() const { return op_ == Token::EQ_STRICT; } 483 bool strict() const { return op_ == Token::EQ_STRICT; }
503 Condition GetCondition() const { return ComputeCondition(op_); } 484 Condition GetCondition() const { return ComputeCondition(op_); }
504 485
505 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op); 486 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
506 487
507 static void Clear(Isolate* isolate, Address address, Code* target, 488 static void Clear(Isolate* isolate, Address address, Code* target,
508 Address constant_pool); 489 Address constant_pool);
(...skipping 14 matching lines...) Expand all
523 504
524 // Helper for BinaryOpIC and CompareIC. 505 // Helper for BinaryOpIC and CompareIC.
525 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 506 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
526 void PatchInlinedSmiCode(Isolate* isolate, Address address, 507 void PatchInlinedSmiCode(Isolate* isolate, Address address,
527 InlinedSmiCheck check); 508 InlinedSmiCheck check);
528 509
529 } // namespace internal 510 } // namespace internal
530 } // namespace v8 511 } // namespace v8
531 512
532 #endif // V8_IC_H_ 513 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698