Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 9378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9389 PrintF(" ** Queueing "); | 9389 PrintF(" ** Queueing "); |
| 9390 PrintName(); | 9390 PrintName(); |
| 9391 PrintF(" for concurrent recompilation.\n"); | 9391 PrintF(" for concurrent recompilation.\n"); |
| 9392 } | 9392 } |
| 9393 set_code_no_write_barrier( | 9393 set_code_no_write_barrier( |
| 9394 GetIsolate()->builtins()->builtin(Builtins::kInOptimizationQueue)); | 9394 GetIsolate()->builtins()->builtin(Builtins::kInOptimizationQueue)); |
| 9395 // No write barrier required, since the builtin is part of the root set. | 9395 // No write barrier required, since the builtin is part of the root set. |
| 9396 } | 9396 } |
| 9397 | 9397 |
| 9398 | 9398 |
| 9399 Handle<JSFunction> JSFunction::Copy(Handle<JSFunction> function) { | |
| 9400 Isolate* isolate = function->GetIsolate(); | |
| 9401 Handle<Map> map(function->map()); | |
| 9402 Handle<SharedFunctionInfo> shared(function->shared()); | |
| 9403 Handle<Context> context(function->context()); | |
| 9404 Handle<JSFunction> clone = | |
| 9405 isolate->factory()->NewFunctionWithMapFromSharedFunctionInfo( | |
| 9406 map, shared, context); | |
| 9407 | |
| 9408 if (shared->bound()) { | |
| 9409 clone->set_function_bindings(function->function_bindings()); | |
| 9410 } | |
| 9411 | |
| 9412 clone->set_properties( | |
|
arv (Not doing code reviews)
2014/08/20 15:35:53
For F.p.toMethod we should not copy the properties
| |
| 9413 *isolate->factory()->NewFixedArray(function->properties()->length())); | |
| 9414 | |
| 9415 Handle<FixedArrayBase> original_elements(function->elements()); | |
|
Toon Verwaest
2014/08/20 07:43:11
Use the ElementsAccessor Copy method instead.
| |
| 9416 if (original_elements->length() > 0) { | |
| 9417 if (original_elements->IsFixedArray()) { | |
| 9418 clone->set_elements(*isolate->factory()->CopyFixedArray( | |
| 9419 Handle<FixedArray>::cast(original_elements))); | |
| 9420 } else if (original_elements->IsFixedDoubleArray()) { | |
| 9421 clone->set_elements(*isolate->factory()->CopyFixedDoubleArray( | |
| 9422 Handle<FixedDoubleArray>::cast(original_elements))); | |
| 9423 } else { | |
| 9424 CHECK(false); | |
| 9425 } | |
| 9426 } | |
| 9427 | |
| 9428 | |
| 9429 Handle<DescriptorArray> descriptors(map->instance_descriptors()); | |
| 9430 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | |
| 9431 Handle<Name> name(descriptors->GetKey(i)); | |
| 9432 PropertyDetails details(descriptors->GetDetails(i)); | |
| 9433 if (details.type() == NORMAL || details.type() == FIELD) { | |
|
Toon Verwaest
2014/08/20 07:43:11
NORMAL is not a valid entry for descriptors. Only
| |
| 9434 Handle<Object> value = | |
| 9435 Object::GetProperty(function, name).ToHandleChecked(); | |
| 9436 JSObject::SetOwnPropertyIgnoreAttributes( | |
| 9437 clone, | |
| 9438 name, | |
| 9439 value, | |
| 9440 details.attributes()).Assert(); | |
| 9441 } | |
| 9442 } | |
| 9443 return clone; | |
| 9444 } | |
| 9445 | |
| 9446 | |
| 9399 void SharedFunctionInfo::AddToOptimizedCodeMap( | 9447 void SharedFunctionInfo::AddToOptimizedCodeMap( |
| 9400 Handle<SharedFunctionInfo> shared, | 9448 Handle<SharedFunctionInfo> shared, |
| 9401 Handle<Context> native_context, | 9449 Handle<Context> native_context, |
| 9402 Handle<Code> code, | 9450 Handle<Code> code, |
| 9403 Handle<FixedArray> literals, | 9451 Handle<FixedArray> literals, |
| 9404 BailoutId osr_ast_id) { | 9452 BailoutId osr_ast_id) { |
| 9405 Isolate* isolate = shared->GetIsolate(); | 9453 Isolate* isolate = shared->GetIsolate(); |
| 9406 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 9454 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 9407 DCHECK(native_context->IsNativeContext()); | 9455 DCHECK(native_context->IsNativeContext()); |
| 9408 STATIC_ASSERT(kEntryLength == 4); | 9456 STATIC_ASSERT(kEntryLength == 4); |
| (...skipping 7250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16659 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16707 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16660 static const char* error_messages_[] = { | 16708 static const char* error_messages_[] = { |
| 16661 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16709 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16662 }; | 16710 }; |
| 16663 #undef ERROR_MESSAGES_TEXTS | 16711 #undef ERROR_MESSAGES_TEXTS |
| 16664 return error_messages_[reason]; | 16712 return error_messages_[reason]; |
| 16665 } | 16713 } |
| 16666 | 16714 |
| 16667 | 16715 |
| 16668 } } // namespace v8::internal | 16716 } } // namespace v8::internal |
| OLD | NEW |